summaryrefslogtreecommitdiffstatshomepage
path: root/py/objstr.c
Commit message (Collapse)AuthorAge
* py: Abstract no-return attribute for functions a bit.Paul Sokolovsky2014-04-30
|
* objstr: Optimize .rstrip() by scanning string from end.Paul Sokolovsky2014-04-26
|
* objstr: Implement .lstrip() & .rstrip().Paul Sokolovsky2014-04-26
| | | | Share code with .strip(). TODO: optimize .rstrip().
* objstr: Init hash in mp_obj_str_builder_start() to 0.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: 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.
* py: Add len(bytes).Damien George2014-04-15
|
* py: Add builtin functions bin and oct, and some tests for them.Damien George2014-04-15
|
* Make USE_COMPUTED_GOTO a config option in mpconfig.h.Damien George2014-04-14
| | | | Disabled by default. Enabled in unix port.
* objstr: Allow to define statically allocated str objects.Paul Sokolovsky2014-04-14
| | | | | Similar to tuples, lists, dicts. Statically allocated strings don't have hash computed.
* qstr, objstr: Make sure that valid hash != 0, treat 0 as "not computed".Paul Sokolovsky2014-04-14
| | | | | This feature was proposed with initial hashing RFC, and is prerequisite for seamless static str object definition.
* py: Make bytes type hashable.Paul Sokolovsky2014-04-13
|
* objstr: Add str.encode() and bytes.decode() methods.Paul Sokolovsky2014-04-13
| | | | | These largely duplicate str() & bytes() constructors' functionality, but can be used to achieve Python2 compatibility.
* py: Simplify and improve mp_get_index.Damien George2014-04-11
| | | | | | | It has (again) a fast path for ints, and a simplified "slow" path for everything else. Also simplify the way str indexing is done (now matches tuple and list).
* objstr: Add TODO-optimize for using .join with arbitrary iterable.Paul Sokolovsky2014-04-10
|
* Merge branch 'str-index' of github.com:xbe/micropython into xbe-str-indexDamien George2014-04-09
|\
| * py: Implement str.[r]index() and add tests for them.xbe2014-04-08
| |
| * py: Update comment in str.replace().xbe2014-04-08
| |
* | py: Add mp_obj_is_integer; make mp_get_index check for long int.Damien George2014-04-09
| | | | | | | | | | mp_obj_is_integer should be used to check if an object is of integral type. It returns true for bool, small int and long int.
* | py: str.join can now take arbitrary iterable as argument.Damien George2014-04-09
|/
* bytes: Support buffer protocol.Paul Sokolovsky2014-04-08
|
* Display \r and \t escape codes in string reprAndrew Scheller2014-04-08
|
* py: Rename pfenv_print_int to pfenv_print_mp_int, and add back former.Damien George2014-04-08
| | | | | | | | | | | | | | stmhal relies on pfenv_* to implement its printf. Thus, it needs a pfenv_print_int which prints a proper 32-bit integer. With latest change to pfenv, this function became one that took mp_obj_t, and extracted the integer value from that object. To fix temporarily, pfenv_print_int has been renamed to pfenv_print_mp_int (to indicate it takes a mp_obj_t for the int), and pfenv_print_int has been added (which takes a normal C int). Currently, pfenv_print_int proxies to pfenv_print_mp_int, but this means it looses the MSB. Need to find a way to fix this, but the only way I can think of will duplicate lots of code.
* Add string formatting support for longlong and mpz.Dave Hylands2014-04-07
|
* py: Fix str.replace for case when arg 0 or 1 is empty string.Damien George2014-04-07
|
* py: str.split: handle non-default separator.Damien George2014-04-06
|
* 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.
* 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.