summaryrefslogtreecommitdiffstatshomepage
path: root/py/objstr.c
Commit message (Collapse)AuthorAge
* Allow floating point arguments with %d,i,u,o,x,X formatsDave Hylands2014-04-05
|
* Implements most of str.moduloDave Hylands2014-04-03
| | | | | The alternate form for floating point doesn't work yet. The %(name)s form doesn't work yet.
* Merge branch 'fix-format-int' of github.com:dhylands/micropython into ↵Damien George2014-04-02
|\ | | | | | | | | | | | | dhylands-fix-format-int Conflicts: py/objstr.c
| * Fix str.format to work with {:f/g/e} and intsDave Hylands2014-04-02
| | | | | | | | Also fix objstr.c to compile when floats disabled.
* | py: Fix regress for printing of floats and #if.Damien George2014-04-02
|/ | | | | Also change formating modifier in test script (it still passes with original format though).
* py: Fix up so that it can compile without float.Damien George2014-04-02
|
* Enhance str.format supportDave Hylands2014-04-01
| | | | | | | | | | | This adds support for almost everything (the comma isn't currently supported). The "unspecified" type with floats also doesn't behave exactly like python. Tested under unix with float and double Spot tested on stmhal
* objstr: Very basic implementation of % string formatting operator.Paul Sokolovsky2014-03-31
|
* py: Remove old "run time" functions that were 1 liners.Damien George2014-03-31
|
* 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.
* py: Rename old const type objects to mp_type_* for consistency.Damien George2014-03-29
|
* py: Change mp_const_* objects to macros.Damien George2014-03-29
| | | | Addresses issue #388.
* 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
|
* Implement str.rfind() and add tests for it.xbe2014-03-24
|
* py/objstr.c: Remove done TODOs.xbe2014-03-23
|
* py: Make 'bytes' be a proper type, support standard constructor args.Paul Sokolovsky2014-03-22
|
* py: Make 'str' be a proper type, support standard constructor args.Paul Sokolovsky2014-03-22
|
* objstr: Switch from in-object string data to ptr to separate memory area.Paul Sokolovsky2014-03-22
| | | | | | This is pre-requisite for having efficient implementation of str<->bytes conversion, and having that efficient is required with unfortunare str vs bytes dichotomy in Python3.
* py: Make str.[r]partition more efficient.Damien George2014-03-21
|
* str.(r)partition: factor out duplicate code.xbe2014-03-21
| | | | | Switch str.rpartition to search from left to right. Factor the duplicate code into one helper function.
* Implement str.rpartition and add tests for it.xbe2014-03-21
|
* Implement str.partition and add tests for it.xbe2014-03-21
|
* objstr.c: Replace size_t with machine_uint_t.xbe2014-03-17
|
* py: Clean up includes.xbe2014-03-17
| | | | Remove unnecessary includes. Add includes that improve portability.
* py: In string.count, handle case of zero-length needle.Damien George2014-03-13
|
* Fix issues in str.count implementation.xbe2014-03-13
| | | | See pull request #343.
* 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: Make objstr support buffer protocol (read only).Damien George2014-03-09
|
* 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().
* objstr: Mark few local symbols as static, cleanup codestyle.Paul Sokolovsky2014-02-11
| | | | Please don't submit patches with tab indentation!
* 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.
* Fix assert() usage.Paul Sokolovsky2014-02-02
|
* Implement str/bytes rich comparisons.Paul Sokolovsky2014-02-02
|
* Factor out m_seq_get_fast_slice_indexes() fucntions as sequence helper.Paul Sokolovsky2014-02-02
| | | | | Takes slice object and sequence length and computes subsequence indexes for case of slice step=1.
* py: Tidy up BINARY_OPs; negation done by special NOT bytecode.Damien George2014-02-01
| | | | | IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new special NOT bytecode.
* py: Make str.replace do 2 passes over the string.Damien George2014-01-31
|
* Implement str.replace and add tests for it.xbe2014-01-30
|
* Factor out quoted string print function for reuse (mp_str_print_quoted()).Paul Sokolovsky2014-01-28
|
* Implement mp_parse_node_free; print properly repr(string).Damien George2014-01-25
|
* py: Implement iterator support for object that has __getitem__.Damien George2014-01-25
| | | | Addresses Issue #203.
* Add basic implementation of bytes type, piggybacking on str.Paul Sokolovsky2014-01-24
| | | | | This reuses as much str implementation as possible, from this we can make them more separate as needed.
* py: Implement bool unary op; tidy up unary op dispatch.Damien George2014-01-23
|
* Implement simplest case of str.startswith().Paul Sokolovsky2014-01-23
|
* Second stage of qstr revamp: uPy str object can be qstr or not.Damien George2014-01-22
|