summaryrefslogtreecommitdiff
path: root/py/objmodule.c
AgeCommit message (Collapse)Author
2016-04-12extmod: Add initial framebuf module.Damien George
2016-03-24extmod/modwebsocket: Start module for WebSocket helper functions.Paul Sokolovsky
Currently, only write support is implemented (of limited buffer size).
2016-01-17extmod/modurandom: Add "urandom" module.Paul Sokolovsky
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
2015-12-13unix: Move modmachine into unix directoryDave Hylands
This leaves behind the common functionality in extmod/machine_mem.c which can be used by all ports.
2015-12-07py: Make it easy to build without MICROPY_PY_BUILTINS_COMPLEX.Paul Sokolovsky
Automagically skip related modules.
2015-12-05py/modsys: Implement sys.modules.Paul Sokolovsky
This for example will allow people to reload modules which didn't load successfully (e.g. due to syntax error).
2015-11-29py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.Damien George
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.
2015-11-29py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George
2015-10-27extmod/modlwip: slip: Use stream protocol and be port-independent.Paul Sokolovsky
Based on the original patch by Galen Hazelwood: https://github.com/micropython/micropython/pull/1517 .
2015-10-12py: Add support to call __init__ from a builtin module on first import.Damien George
2015-10-06modussl: SSL socket wrapper module based on axTLS.Paul Sokolovsky
2015-05-04modstruct: Rename module to "ustruct", to allow full Python-level impl.Paul Sokolovsky
2015-05-04modmachine: Add new module to access hardware, starting with physical memory.Paul Sokolovsky
Refactored from "stm" module, provides mem8, mem16, mem32 objects with array subscript syntax.
2015-04-16py: Add %q format support to mp_[v]printf, and use it.Damien George
2015-04-16py: Overhaul and simplify printf/pfenv mechanism.Damien George
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.
2015-04-11py: Combine load_attr and store_attr type methods into one (attr).Damien George
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.
2015-03-20py: Implement core of OrderedDict type.Paul Sokolovsky
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.
2015-01-20py, unix: Allow to compile with -Wunused-parameter.Damien George
See issue #699.
2015-01-20py, unix, stmhal: Allow to compile with -Wshadow.Damien George
See issue #699.
2015-01-07py: Put all global state together in state structures.Damien George
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.
2015-01-01py: Move to guarded includes, everywhere in py/ core.Damien George
Addresses issue #1022.
2014-12-09py: Allow builtins to be overridden.Damien George
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.
2014-11-05unix: fast: Set initial module dict size big to have high pystone score.Paul Sokolovsky
For this, introduce MICROPY_MODULE_DICT_SIZE config setting.
2014-09-08py: Print imported module's location (__file__) if available.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-02py, unix: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky
Specifically, nlr.h does.
2014-04-08py: Finish implementation of all del opcodes.Damien George
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.
2014-04-05py: Make globals and locals proper dictionary objects.Damien George
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.
2014-04-05py: Change module globals from mp_map_t* to mp_obj_dict_t*.Damien George
Towards addressing issue #424. Had a small increase to ROM usage (order 60 bytes).
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-25Proper support for registering builtin modules in ROM.Damien George
Comes with some refactoring of code and renaming of files. All modules are now named mod*.[ch].
2014-03-25Add mp_obj_module_registermux
* Add function to load static modules. * Use module_register to pyb module.
2014-03-17py: Clean up includes.xbe
Remove unnecessary includes. Add includes that improve portability.
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-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-12Replace global "static" -> "STATIC", to allow "analysis builds". Part 1.Paul Sokolovsky
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().
2014-02-05Search paths properly on import and execute __init__.py if it exists.Damien George
2014-01-22py: Initialise loaded_module map in rt_init.Damien George
STM port crashes without this re-init. There should not be any state in the core py/ code that relies on pre-initialised data.
2014-01-22Second stage of qstr revamp: uPy str object can be qstr or not.Damien George
2014-01-21Revamp qstrs: they now include length and hash.Damien George
Can now have null bytes in strings. Can define ROM qstrs per port using qstrdefsport.h
2014-01-20Implement modules as singletons Python semantics.Paul Sokolovsky
In Python, importing module several times returns same underlying module object. This also fixes import statement handling for builtin modules. There're still issues: 1. CPython exposes set of loaded modules as sys.modules, we may want to do that either. 2. Builtin modules are implicitly imported, which is not really correct. We should separate registering a (builtin) module and importing a module. CPython keeps builtin module names in sys.builtin_module_names .
2014-01-18Make VM stack grow upwards, and so no reversed args arrays.Damien George
Change state layout in VM so the stack starts at state[0] and grows upwards. Locals are at the top end of the state and number downwards. This cleans up a lot of the interface connecting the VM to C: now all functions that take an array of Micro Python objects are in order (ie no longer in reverse). Also clean up C API with keyword arguments (call_n and call_n_kw replaced with single call method that takes keyword arguments). And now make_new takes keyword arguments. emitnative.c has not yet been changed to comply with the new order of stack layout.
2014-01-15type->print(): Distinguish str() and repr() variety by passing extra param.Paul Sokolovsky
2014-01-09Improved type/class/instance code; mp_obj_type_t now has load_attr, store_attr.Damien George
Creating of classes (types) and instances is much more like CPython now. You can use "type('name', (), {...})" to create classes.
2014-01-08py: Stuff qstr in object pointer; keys for mp_map_t are now always mp_obj_t.Damien George
2014-01-07py: Fix allocation of unique code blocks.Damien George
2014-01-07Merge branch 'cplusplus' of https://github.com/ian-v/micropython into ↵Damien George
ian-v-cplusplus Conflicts: py/objcomplex.c
2014-01-06Co-exist with C++ (issue #85)ian-v
2014-01-05Convert many object types structs to use C99 tagged initializer syntax.Paul Sokolovsky