summaryrefslogtreecommitdiffstatshomepage
path: root/py/objmodule.c
Commit message (Collapse)AuthorAge
* all: Use the name MicroPython consistently in commentsAlexander Steffen2017-07-31
| | | | | There were several different spellings of MicroPython present in comments, when there should be only one.
* py/objmodule: Move module init/deinit code into runtime functions.Damien George2017-01-26
| | | | | | They are one-line functions and having them inline in mp_init/mp_deinit eliminates the overhead of a function call, and matches how other state is initialised in mp_init.
* py: Move weak-link map to objmodule.c, and expose module maps as public.Damien George2017-01-22
|
* extmod/modutimeq: Refactor into optimized class.Paul Sokolovsky2016-12-22
| | | | | | | | | | import utimeq, utime # Max queue size, the queue allocated statically on creation q = utimeq.utimeq(10) q.push(utime.ticks_ms(), data1, data2) res = [0, 0, 0] # Items in res are filled up with results q.pop(res)
* stmhal/moduselect: Move to extmod/ for reuse by other ports.Paul Sokolovsky2016-11-21
|
* all: Remove 'name' member from mp_obj_module_t struct.Damien George2016-09-22
| | | | One can instead lookup __name__ in the modules dict to get the value.
* py: Add basic _thread module, with ability to start a new thread.Damien George2016-06-28
|
* py: Support to build berkeley db 1.85 and "btree" module.Paul Sokolovsky2016-06-15
|
* py: Add uerrno module, with errno constants and dict.Damien George2016-05-10
|
* py/modcollections: Rename module name have "u" prefix for consistency.Paul Sokolovsky2016-05-02
|
* py/modio: Rename module name to "uio" for consistency with other modules.Paul Sokolovsky2016-05-02
|
* extmod/modwebrepl: Module to handle WebREPL protocol.Paul Sokolovsky2016-04-29
| | | | | | | While just a websocket is enough for handling terminal part of WebREPL, handling file transfer operations requires demultiplexing and acting upon, which is encapsulated in _webrepl class provided by this module, which wraps a websocket object.
* extmod: Add initial framebuf module.Damien George2016-04-12
|
* extmod/modwebsocket: Start module for WebSocket helper functions.Paul Sokolovsky2016-03-24
| | | | Currently, only write support is implemented (of limited buffer size).
* 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
* unix: Move modmachine into unix directoryDave Hylands2015-12-13
| | | | | This leaves behind the common functionality in extmod/machine_mem.c which can be used by all ports.
* py: Make it easy to build without MICROPY_PY_BUILTINS_COMPLEX.Paul Sokolovsky2015-12-07
| | | | Automagically skip related modules.
* py/modsys: Implement sys.modules.Paul Sokolovsky2015-12-05
| | | | | This for example will allow people to reload modules which didn't load successfully (e.g. due to syntax error).
* py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.Damien George2015-11-29
| | | | | | | | | This allows the mp_obj_t type to be configured to something other than a pointer-sized primitive type. This patch also includes additional changes to allow the code to compile when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of mp_uint_t, and various casts.
* py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George2015-11-29
|
* extmod/modlwip: slip: Use stream protocol and be port-independent.Paul Sokolovsky2015-10-27
| | | | | Based on the original patch by Galen Hazelwood: https://github.com/micropython/micropython/pull/1517 .
* py: Add support to call __init__ from a builtin module on first import.Damien George2015-10-12
|
* modussl: SSL socket wrapper module based on axTLS.Paul Sokolovsky2015-10-06
|
* modstruct: Rename module to "ustruct", to allow full Python-level impl.Paul Sokolovsky2015-05-04
|
* modmachine: Add new module to access hardware, starting with physical memory.Paul Sokolovsky2015-05-04
| | | | | Refactored from "stm" module, provides mem8, mem16, mem32 objects with array subscript syntax.
* py: Add %q format support to mp_[v]printf, and use it.Damien George2015-04-16
|
* py: Overhaul and simplify printf/pfenv mechanism.Damien George2015-04-16
| | | | | | | | | | | | | | | | | | | | | | Previous to this patch the printing mechanism was a bit of a tangled mess. This patch attempts to consolidate printing into one interface. All (non-debug) printing now uses the mp_print* family of functions, mainly mp_printf. All these functions take an mp_print_t structure as their first argument, and this structure defines the printing backend through the "print_strn" function of said structure. Printing from the uPy core can reach the platform-defined print code via two paths: either through mp_sys_stdout_obj (defined pert port) in conjunction with mp_stream_write; or through the mp_plat_print structure which uses the MP_PLAT_PRINT_STRN macro to define how string are printed on the platform. The former is only used when MICROPY_PY_IO is defined. With this new scheme printing is generally more efficient (less layers to go through, less arguments to pass), and, given an mp_print_t* structure, one can call mp_print_str for efficiency instead of mp_printf("%s", ...). Code size is also reduced by around 200 bytes on Thumb2 archs.
* py: Combine load_attr and store_attr type methods into one (attr).Damien George2015-04-11
| | | | | | This simplifies the API for objects and reduces code size (by around 400 bytes on Thumb2, and around 2k on x86). Performance impact was measured with Pystone score, but change was barely noticeable.
* py: Implement core of OrderedDict type.Paul Sokolovsky2015-03-20
| | | | | | | | | | | | Given that there's already support for "fixed table" maps, which are essentially ordered maps, the implementation of OrderedDict just extends "fixed table" maps by adding an "is ordered" flag and add/remove operations, and reuses 95% of objdict code, just making methods tolerant to both dict and OrderedDict. Some things are missing so far, like CPython-compatible repr and comparison. OrderedDict is Disabled by default; enabled on unix and stmhal ports.
* py, unix: Allow to compile with -Wunused-parameter.Damien George2015-01-20
| | | | See issue #699.
* py, unix, stmhal: Allow to compile with -Wshadow.Damien George2015-01-20
| | | | See issue #699.
* py: Put all global state together in state structures.Damien George2015-01-07
| | | | | | This patch consolidates all global variables in py/ core into one place, in a global structure. Root pointers are all located together to make GC tracing easier and more efficient.
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* py: Allow builtins to be overridden.Damien George2014-12-09
| | | | | | | | | | | | | | This patch adds a configuration option (MICROPY_CAN_OVERRIDE_BUILTINS) which, when enabled, allows to override all names within the builtins module. A builtins override dict is created the first time the user assigns to a name in the builtins model, and then that dict is searched first on subsequent lookups. Note that this implementation doesn't allow deleting of names. This patch also does some refactoring of builtins code, creating the modbuiltins.c file. Addresses issue #959.
* unix: fast: Set initial module dict size big to have high pystone score.Paul Sokolovsky2014-11-05
| | | | For this, introduce MICROPY_MODULE_DICT_SIZE config setting.
* py: Print imported module's location (__file__) if available.Damien George2014-09-08
|
* 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.
* py: Finish implementation of all del opcodes.Damien George2014-04-08
| | | | | | | At this point, all opcodes are now implemented! Some del opcodes have been combined with store opcodes, with the value to store being MP_OBJ_NULL.
* 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).
* 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.
* Proper support for registering builtin modules in ROM.Damien George2014-03-25
| | | | | Comes with some refactoring of code and renaming of files. All modules are now named mod*.[ch].
* Add mp_obj_module_registermux2014-03-25
| | | | | * Add function to load static modules. * Use module_register to pyb module.
* py: Clean up includes.xbe2014-03-17
| | | | Remove unnecessary includes. Add includes that improve portability.
* Implement ROMable modules. Add math module.Damien George2014-03-08
| | | | | | | | | | 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).
* Implement proper exception type hierarchy.Damien George2014-02-15
| | | | | | | | | | | | | | 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.
* Change mp_obj_type_t.name from const char * to qstr.Damien George2014-02-15
| | | | | | 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.
* Replace global "static" -> "STATIC", to allow "analysis builds". Part 1.Paul Sokolovsky2014-02-12
| | | | | | | | Some tools do not support local/static symbols (one example is GNU ld map file). Exposing all functions will allow to do detailed size comparisons, etc. Also, added bunch of statics where they were missing, and replaced few identity functions with global mp_identity().
* Search paths properly on import and execute __init__.py if it exists.Damien George2014-02-05
|