aboutsummaryrefslogtreecommitdiff
path: root/py/objarray.c
AgeCommit message (Collapse)Author
2016-07-06py/objarray: Split out header to allow direct access to object.Paul Sokolovsky
This follows source code/header file organization similar to few other objects, and intended to be used only is special cases, where efficiency/ simplicity matters.
2016-04-07py/objarray: Fix array.append so it doesn't extend if append fails.Damien George
Addresses issue #1965.
2016-03-14py/objarray: Fix array slice assignment when array is reallocated.Damien George
Addresses issue #1898.
2016-02-14py/objarray: Implement "in" operator for bytearray.Paul Sokolovsky
2016-01-11py: Change first arg of type.make_new from mp_obj_t to mp_obj_type_t*.Damien George
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.
2016-01-11py: Change type of .make_new and .call args: mp_uint_t becomes size_t.Damien George
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.
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-11py: Rename MP_BOOL() to mp_obj_new_bool() for consistency in naming.Paul Sokolovsky
2015-09-04py: Eliminate some cases which trigger unused parameter warnings.Damien George
2015-09-03py: Use mp_not_implemented consistently for not implemented features.Damien George
2015-06-06py: reduce array slice assignment code sizeDelio Brignoli
2015-07-20py: Small code space optimisations for memoryview slice assigment.Damien George
Also adds #if guards to allow uPy core to compile without memoryview enabled, but with slice assignment enabled.
2015-07-20py: Implement memoryview slice assignment.Delio Brignoli
Adds ability to do "memcpy" with memoryview objects, such as: m1[0:3] = m2[2:5].
2015-07-02py/objarray.c: Allow to build with debugging and bytearray but no array.Damien George
2015-05-17py/binary: Make return type of mp_binary_get_size size_t instead of int.Kaspar Schleiser
Fixes sign-compare warning.
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-16objarray: Support assignment of bytes to bytearray slice.Paul Sokolovsky
2015-03-19py: Allow to compile with extra warnings (sign-compare, unused-param).Damien George
2015-03-06objmemoryview: Introduce mp_obj_new_memoryview().Paul Sokolovsky
This follows existing pattern for object constructor API and allows to create memoryview objects e.g. in external modules.
2015-03-04objarray: Fix typo in null TYPECODE_MASK.Paul Sokolovsky
2015-03-03py: Add MICROPY_MALLOC_USES_ALLOCATED_SIZE to allow simpler malloc API.Damien George
2015-02-27objarray: Implement array slice assignment.Paul Sokolovsky
This is rarely used feature which takes enough code to implement, so is controlled by MICROPY_PY_ARRAY_SLICE_ASSIGN config setting, default off. But otherwise it may be useful, as allows to update arbitrary-sized data buffers in-place. Slice is yet to implement, and actually, slice assignment implemented in such a way that RHS of assignment should be array of the exact same item typecode as LHS. CPython has it more relaxed, where RHS can be any sequence of compatible types (e.g. it's possible to assign list of int's to a bytearray slice). Overall, when all "slice write" features are implemented, it may cost ~1KB of code.
2015-02-27py: Use m_{new,renew,del} consistently.Damien George
This is so all memory requests go through the same interface.
2015-01-20py, unix: Allow to compile with -Wunused-parameter.Damien George
See issue #699.
2015-01-04objarray: Make sure that longint works as bytearray size.Paul Sokolovsky
2015-01-01py: Move to guarded includes, everywhere in py/ core.Damien George
Addresses issue #1022.
2014-12-04py: Allow bytes/bytearray/array to be init'd by buffer protocol objects.Damien George
Behaviour of array initialisation is subtly different for bytes, bytearray and array.array when argument has buffer protocol. This patch gets us CPython conformant (except we allow initialisation of array.array by buffer with length not a multiple of typecode).
2014-11-30py: Generalise and reduce code size of array +, += and .extend().Damien George
By using the buffer protocol for these array operations, we now allow addition of memoryview objects, and objects with "incompatible" typecodes (in this case it just adds bytes naively). This is an extension to CPython which seems sensible. It also reduces the code size.
2014-11-30py: Implement +, += and .extend for bytearray and array objs.Damien George
Addresses issue #994.
2014-10-29Fix errors after enabling -Wpointer-arithstijn
2014-10-26py: Fix memoryview referencing so it retains ptr to original buffer.Damien George
This way, if original parent object is GC'd, the memoryview still points to the underlying buffer data so that buffer is not GC'd.
2014-10-23py: Add builtin memoryview object (mostly using array code).Damien George
2014-10-03py: Convert [u]int to mp_[u]int_t where appropriate.Damien George
Addressing issue #50.
2014-08-30py: Change uint to mp_uint_t in runtime.h, stackctrl.h, binary.h.Damien George
Part of code cleanup, working towards resolving issue #50.
2014-08-30py: Remove use of int type in obj.h.Damien George
Part of code cleanup, working towards resolving issue #50.
2014-08-30py: Change all uint to mp_uint_t in obj.h.Damien George
Part of code cleanup, working towards resolving issue #50.
2014-08-30Change some parts of the core API to use mp_uint_t instead of uint/int.Damien George
Addressing issue #50, still some way to go yet.
2014-08-10objarray: Implement equality testing between arrays and other buffers.Paul Sokolovsky
2014-07-17py: Remove unnecessary argument in bytearray print.Damien George
2014-07-03Rename machine_(u)int_t to mp_(u)int_t.Damien George
See discussion in issue #50.
2014-06-27py: Allow to disable array module and bytearray type.Paul Sokolovsky
array.array and bytearray share big deal of code, so to get real savings, both need to be disabled.
2014-06-14objstr: Be 8-bit clean even for repr().Paul Sokolovsky
This will allow roughly the same behavior as Python3 for non-ASCII strings, for example, print("<phrase in non-Latin script>".split()) will print list of words, not weird hex dump (like Python2 behaves). (Of course, that it will print list of words, if there're "words" in that phrase at all, separated by ASCII-compatible whitespace; that surely won't apply to every human language in existence).
2014-06-05py: Small changes to objstr.c, including a bug fix.Damien George
Some small fixed: - Combine 'x' and 'X' cases in str format code. - Remove trailing spaces from some lines. - Make exception messages consistently begin with lower case (then needed to change those in objarray and objtuple so the same constant string data could be used). - Fix bug with exception message having %c instead of %%c.
2014-06-01py: Fix configurability of builtin slice.Damien George
2014-05-25objlist: Implement support for arbitrary (3-arg) slices.Paul Sokolovsky
2014-05-25py: Refactor slice helpers, preparing to support arbitrary slicing.Paul Sokolovsky
2014-05-21py: Rename MP_OBJ_NOT_SUPPORTED to MP_OBJ_NULL.Damien George
See issue #608 for justification.
2014-05-13py, unix: Add copyright for modules I worked closely on.Paul Sokolovsky
2014-05-10py: Fix prefix on few sequence helpers, was incorrectly "mp_".Paul Sokolovsky