summaryrefslogtreecommitdiffstatshomepage
path: root/py/objarray.c
Commit message (Collapse)AuthorAge
* objstr: Be 8-bit clean even for repr().Paul Sokolovsky2014-06-14
| | | | | | | | | 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).
* py: Small changes to objstr.c, including a bug fix.Damien George2014-06-05
| | | | | | | | | | | | | | 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.
* py: Fix configurability of builtin slice.Damien George2014-06-01
|
* objlist: Implement support for arbitrary (3-arg) slices.Paul Sokolovsky2014-05-25
|
* py: Refactor slice helpers, preparing to support arbitrary slicing.Paul Sokolovsky2014-05-25
|
* py: Rename MP_OBJ_NOT_SUPPORTED to MP_OBJ_NULL.Damien George2014-05-21
| | | | See issue #608 for justification.
* py, unix: Add copyright for modules I worked closely on.Paul Sokolovsky2014-05-13
|
* py: Fix prefix on few sequence helpers, was incorrectly "mp_".Paul Sokolovsky2014-05-10
|
* 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: Clear allocated, but unused memory in containers.Paul Sokolovsky2014-04-28
| | | | | | Also, clear up freed slots in containers. As a follow up to 32bef315be8e56ad2d7f69223fe7b9606893b6ab.
* objarray: Slice subscription operation: properly test for op subtype.Paul Sokolovsky2014-04-20
| | | | | Also, checked that both bytearray and array.array actually support generic (a-la list) slice assignment and deletion. Added TODOs.
* Merge branch 'master' of github.com:micropython/micropythonDamien George2014-04-20
|\
| * objarray: Implement slice subscription.Paul Sokolovsky2014-04-19
| |
* | py: Add arg checking helper functions.Damien George2014-04-20
|/ | | | | | | These are to assist in writing native C functions that take positional and keyword arguments. mp_arg_check_num is for just checking the number of arguments is correct. mp_arg_parse_all is for parsing positional and keyword arguments with default values.
* modstruct: Fix .calcsize() to account for struct type/alignment.Paul Sokolovsky2014-04-19
|
* py: Add typecode to buffer protocol.Damien George2014-04-18
| | | | | | | When querying an object that supports the buffer protocol, that object must now return a typecode (as per binary.[ch]). This does not have to be honoured by the caller, but can be useful for determining element size.
* py: Tidy up array.array; add more error handling.Damien George2014-04-18
|
* 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: Merge BINARY_OP_SUBSCR and store_subscr (w/ delete) into subscr.Damien George2014-04-17
| | | | mp_obj_t->subscr now does load/store/delete.
* binary: Rename array accessors for clarity.Paul Sokolovsky2014-04-11
|
* py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR.Damien George2014-04-08
| | | | | This makes the runtime and object APIs more consistent. mp_store_subscr functionality now moved into objects (ie list and dict store_item).
* py: Make bytearray a proper type.Paul Sokolovsky2014-04-08
|
* bytearray: Support bytearray(int) constructor.Paul Sokolovsky2014-04-08
| | | | To create bytearray of given length.
* 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: Fix "TypeError: 'iterator' object is not iterable", doh.Paul Sokolovsky2014-03-30
|
* 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.
* Remove mp_obj_type_t.methods entry and use .locals_dict instead.Damien George2014-03-26
| | | | | | | | | | | | | | | | | | | | | | Originally, .methods was used for methods in a ROM class, and locals_dict for methods in a user-created class. That distinction is unnecessary, and we can use locals_dict for ROM classes now that we have ROMable maps. This removes an entry in the bloated mp_obj_type_t struct, saving a word for each ROM object and each RAM object. ROM objects that have a methods table (now a locals_dict) need an extra word in total (removed the methods pointer (1 word), no longer need the sentinel (2 words), but now need an mp_obj_dict_t wrapper (4 words)). But RAM objects save a word because they never used the methods entry. Overall the ROM usage is down by a few hundred bytes, and RAM usage is down 1 word per user-defined type/class. There is less code (no need to check 2 tables), and now consistent with the way ROM modules have their tables initialised. Efficiency is very close to equivaluent.
* Change mp_method_t.name from const char * to qstr.Damien George2014-03-26
| | | | Addresses issue #377.
* py: Replace mp_const_stop_iteration object with MP_OBJ_NULL.Damien George2014-03-26
|
* 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].
* py: Clean up includes.xbe2014-03-17
| | | | Remove unnecessary includes. Add includes that improve portability.
* Implement str.count and add tests for it.xbe2014-03-12
| | | | | | | Also modify mp_get_index to accept: 1. Indices that are or evaluate to a boolean. 2. Slice indices. Add tests for these two cases.
* py: Take out bitfield entries from their own structure.Damien George2014-02-26
| | | | | Don't need to wrap bitfields in their own struct. Compiler does the correct thing without it.
* 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.
* objarray: Refactor to use array accessors from binary.c .Paul Sokolovsky2014-02-14
|
* 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().
* Make mp_obj_str_get_data return char* instead of byte*.Damien George2014-02-08
| | | | | Can't decide which is better for string type, char or byte pointer. Changing to char removes a few casts. Really need to do proper unicode.
* Implement __bool__ and __len__ via unary_op virtual method for all types.Paul Sokolovsky2014-01-30
| | | | | | | __bool__() and __len__() are just the same as __neg__() or __invert__(), and require efficient dispatching implementation (not requiring search/lookup). type->unary_op() is just the right choice for this short of adding standalone virtual method(s) to already big mp_obj_type_t structure.
* mp_obj_new_bytearray_by_ref(): Allow to create array by reference.Paul Sokolovsky2014-01-29
| | | | This is special feature for FFI.
* bytearray: Print objects properly.Paul Sokolovsky2014-01-28
|
* array: CPython prints empty arrays inconsistently (only typecode, no []).Paul Sokolovsky2014-01-28
|
* array.array: Allow to create empty arrays.Paul Sokolovsky2014-01-28
|
* Second stage of qstr revamp: uPy str object can be qstr or not.Damien George2014-01-22
|
* array: Implement iterator.Paul Sokolovsky2014-01-21
|
* Add len() support for arrays.Paul Sokolovsky2014-01-21
|
* Revamp qstrs: they now include length and hash.Damien George2014-01-21
| | | | | Can now have null bytes in strings. Can define ROM qstrs per port using qstrdefsport.h
* Add skeleton implementation of array.array and bytearray.Paul Sokolovsky2014-01-18
So far, only storage, initialization, repr() and buffer protocol is implemented - alredy suitable for passing binary data around.