Commit Graph

2383 Commits

Author SHA1 Message Date
Chris Angelico 5bf0153eca Test a default (= UTF-8) encode and decode 2014-06-10 08:42:06 +10:00
Chris Angelico c962057ac3 Merge branch 'master' into unicode, resolving conflict on py/obj.h 2014-06-10 05:23:03 +10:00
Chris Angelico e2c9782a65 More whitespace fixups 2014-06-10 05:18:00 +10:00
Chris Angelico 086a2a0f57 Properly implement string slicing 2014-06-10 05:05:46 +10:00
Chris Angelico 0d339a143e Support slicing in str_index_to_ptr, and fix a bounds error 2014-06-10 02:24:11 +10:00
Chris Angelico 24371c7267 Break out index-to-pointer calculation into a function 2014-06-10 02:10:22 +10:00
Chris Angelico 616c24ac01 Add tests of string slicing, which currently fail 2014-06-10 02:03:11 +10:00
Chris Angelico a24d19f676 Change string indexing to not precalculate the charlen, and add test for neg indexing 2014-06-10 01:59:46 +10:00
Paul Sokolovsky 195de3247b objtype: Fix passing of class param to inherited classmethods.
This is getting more and more tangled, but that's old news.
2014-06-08 22:28:44 +03:00
Paul Sokolovsky 639863d36e objtype: Optimize stack usage mp_obj_class_lookup().
As before, instead of pushing constant values on stack again and again, just
pass around pointer to a structure.
2014-06-08 20:50:12 +03:00
Damien George 57b4dfa9c9 stmhal: Fix pyb.bootloader so it works for gcc-4.9.0.
See PR #618.
2014-06-08 14:01:43 +01:00
Damien George 26a95ae1e7 windows: Move include of malloc.h outside #ifdef msvc. 2014-06-08 13:50:57 +01:00
Damien George 4297fed1c3 tests: Run 'micropython' tests on pyboard. 2014-06-08 13:46:03 +01:00
Damien George 70c289a7a6 Merge branch 'marcusva-alloca' 2014-06-08 13:26:02 +01:00
Damien George 4480cb3711 Provide definition of alloca() in mpconfigport.h. 2014-06-08 13:25:33 +01:00
Damien George df896eceef Merge branch 'alloca' of github.com:marcusva/micropython into marcusva-alloca 2014-06-08 13:18:14 +01:00
Chris Angelico 0bcc7ab89e Clean up constant qstr declarations now that charlen isn't needed 2014-06-08 22:09:17 +10:00
Damien George 9e951498b2 tests: Add more tests for default keyword-only args. 2014-06-08 12:58:32 +01:00
Damien George 049a7a8153 py: Simplify function call of a bytecode object. 2014-06-08 00:37:40 +01:00
Damien George c06427c019 tests: Fix default arg test. 2014-06-08 00:12:32 +01:00
Paul Sokolovsky b4efac14cd py: Make sure getattr() works with non-interned strings (by interning them). 2014-06-08 01:15:06 +03:00
Chris Angelico 5473e1a1db Remove the charlen field from strings, calculating it when required 2014-06-08 07:18:42 +10:00
Chris Angelico 5c1658ec71 Get rid of mp_obj_str_get_data_len() which was used in only one place 2014-06-08 07:11:27 +10:00
Damien George d31a093f9c Merge branch 'master' of github.com:micropython/micropython
Conflicts:
	py/emitglue.c
2014-06-07 22:02:35 +01:00
Paul Sokolovsky 5473f743f3 objtype: Enable __lt__ method support for instances. 2014-06-08 00:01:46 +03:00
Damien George f0778a7ccb py: Implement default keyword only args.
Should finish addressing issue #524.
2014-06-07 22:01:00 +01:00
Chris Angelico a019ba968b Add a unichar_charlen() function to calculate length-in-characters from length-in-bytes 2014-06-08 06:58:26 +10:00
Paul Sokolovsky b9b9354e6c modsys: Add optional support for sys.platform.
Ports which wants to have it, should define MICROPY_PY_SYS_PLATFORM to a
string value they need.
2014-06-07 23:40:04 +03:00
Chris Angelico 44b0d5cff8 Use utf8_get/next_char in building up a string's repr 2014-06-08 06:32:44 +10:00
Chris Angelico 30d1bad33f Make utf8_get_char() and utf8_next_char() actually do what their names say 2014-06-08 06:32:21 +10:00
Paul Sokolovsky 7e4a2b0edc py: Add generic mp_not_implemented() func to use instead of assert().
Benefits: won't crash baremetal targets, will provide Python source location
when not implemented feature used (it will no longer provide C source
location, but just grep for error message).
2014-06-07 23:26:27 +03:00
Chris Angelico bc990dad9a Revert "Add PEP 393-flags to strings and stub usage."
This reverts commit c239f50952.
2014-06-08 02:10:59 +10:00
Damien George aabd83ea20 py: Merge mp_execute_bytecode into fun_bc_call.
This reduces stack usage by 16 words (64 bytes) for stmhal/ port.

See issue #640.
2014-06-07 14:16:08 +01:00
Damien George 82ed3d62f6 py, mk: Revert change where build variables set with ?=.
?= operator does not do delayed expansion (unlike =).
2014-06-07 13:14:45 +01:00
Damien George a9b5248e18 Merge pull request #672 from marcusva/makefile
toolchain fixes to enable cross compatibility
2014-06-07 13:03:29 +01:00
Damien George dc931934b3 Merge pull request #674 from marcusva/fbsd-patches
Build patches for FreeBSD (as discussed in the former pull request #666)
2014-06-07 13:00:35 +01:00
Marcus von Appen 585a3394df - Cast the struct stat sb.st_ino field to machine_int_t explicitly to avoid a
cast error in MP_OBJ_NEW_SMALL_INT(). This is necessary for FreeBSD, where
  st_ino is of different size
- If MP_CLOCKS_PER_SEC is defined on the target host, simply define CLOCK_DIV
  as a fraction, regardless of the value of MP_CLOCKS_PER_SEC.
  FreeBSD uses a non-POSIX compliant value of 128 for CLOCKS_PER_SEC
2014-06-07 09:50:18 +02:00
Marcus von Appen 0c90eb1658 - FreeBSD provides alloca() via stdlib.h, in contrast to Linux and Windows
- Move the includes for alloca() intp mpconfigport.h
2014-06-07 09:36:04 +02:00
Marcus von Appen 8ffc02495f - Let the build environment decide about the toolchain to be used, in case
there are special tweaks and paths to be considered. Just provide some
  defaults, in case the values are undefined.
- py-version.sh does not need any bash specific features.
- Use libdl only on Linux for now. FreeBSD provides dl*() calls from libc.
2014-06-07 09:16:42 +02:00
Chris Angelico f9bebb28ad Whitespace fixes 2014-06-07 15:41:48 +10:00
Chris Angelico 279de0c8eb Formatting/layout improvements - introduce macros for UTF-8 byte detection, add braces. No functional changes. 2014-06-07 15:28:35 +10:00
Chris Angelico f1911f53d5 Make chr() Unicode-aware 2014-06-07 11:56:02 +10:00
Chris Angelico f51ad737b4 Make a string's repr Unicode-aware 2014-06-07 11:50:43 +10:00
Chris Angelico 01bd686846 Expand the Unicode tests 2014-06-07 11:44:58 +10:00
Chris Angelico 7bc91904f8 Record byte lengths for byte strings 2014-06-07 11:44:58 +10:00
Chris Angelico bb13212071 Make ord() Unicode-aware 2014-06-07 11:44:58 +10:00
Chris Angelico 03f0cbe905 Retain characters as UTF-8 encoded Unicode 2014-06-07 11:34:28 +10:00
Chris Angelico e924659b85 Add support for \u and \U escapes, but not \N (with explanatory comment) 2014-06-07 11:34:28 +10:00
Chris Angelico 231031ac5f Add character length to qstr 2014-06-07 11:34:28 +10:00
Chris Angelico 6df1b946fb Add test of UTF-8 encoded source file resulting in properly formed string 2014-06-07 11:34:28 +10:00