1. 08 May, 2015 1 commit
  2. 04 May, 2015 2 commits
  3. 25 Apr, 2015 1 commit
  4. 16 Apr, 2015 1 commit
    • Damien George's avatar
      py: Overhaul and simplify printf/pfenv mechanism. · 7f9d1d6a
      Damien George authored
      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.
      7f9d1d6a
  5. 03 Apr, 2015 1 commit
    • Paul Sokolovsky's avatar
      objstr: Add .splitlines() method. · ac2f7a7f
      Paul Sokolovsky authored
      splitlines() occurs ~179 times in CPython3 standard library, so was
      deemed worthy to implement. The method has subtle semantic differences
      from just .split("\n"). It is also defined as working for any end-of-line
      combination, but this is currently not implemented - it works only with
      LF line-endings (which should be OK for text strings on any platforms,
      but not OK for bytes).
      ac2f7a7f
  6. 02 Apr, 2015 1 commit
  7. 26 Mar, 2015 1 commit
  8. 20 Mar, 2015 2 commits
    • stijn's avatar
      py: Allow retrieving a function's __name__. · 3cc17c69
      stijn authored
      Disabled by default.  Enabled on unix and stmhal ports.
      3cc17c69
    • Paul Sokolovsky's avatar
      py: Implement core of OrderedDict type. · 0ef01d0a
      Paul Sokolovsky authored
      Given that there's already support for "fixed table" maps, which are
      essentially ordered maps, the implementation of OrderedDict just extends
      "fixed table" maps by adding an "is ordered" flag and add/remove
      operations, and reuses 95% of objdict code, just making methods tolerant
      to both dict and OrderedDict.
      
      Some things are missing so far, like CPython-compatible repr and comparison.
      
      OrderedDict is Disabled by default; enabled on unix and stmhal ports.
      0ef01d0a
  9. 14 Mar, 2015 1 commit
  10. 13 Mar, 2015 1 commit
  11. 03 Mar, 2015 1 commit
  12. 27 Feb, 2015 1 commit
    • Paul Sokolovsky's avatar
      objarray: Implement array slice assignment. · cefcbb22
      Paul Sokolovsky authored
      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.
      cefcbb22
  13. 22 Feb, 2015 1 commit
  14. 30 Jan, 2015 1 commit
  15. 16 Jan, 2015 1 commit
  16. 14 Jan, 2015 1 commit
  17. 10 Jan, 2015 1 commit
  18. 09 Jan, 2015 2 commits
  19. 07 Jan, 2015 2 commits
    • Damien George's avatar
      py: Add option to cache map lookup results in bytecode. · 7ee91cf8
      Damien George authored
      This is a simple optimisation inspired by JITing technology: we cache in
      the bytecode (using 1 byte) the offset of the last successful lookup in
      a map. This allows us next time round to check in that location in the
      hash table (mp_map_t) for the desired entry, and if it's there use that
      entry straight away.  Otherwise fallback to a normal map lookup.
      
      Works for LOAD_NAME, LOAD_GLOBAL, LOAD_ATTR and STORE_ATTR opcodes.
      
      On a few tests it gives >90% cache hit and greatly improves speed of
      code.
      
      Disabled by default.  Enabled for unix and stmhal ports.
      7ee91cf8
    • Damien George's avatar
      py: Put all global state together in state structures. · b4b10fd3
      Damien George authored
      This patch consolidates all global variables in py/ core into one place,
      in a global structure.  Root pointers are all located together to make
      GC tracing easier and more efficient.
      b4b10fd3
  20. 01 Jan, 2015 1 commit
  21. 16 Dec, 2014 1 commit
  22. 14 Dec, 2014 1 commit
  23. 09 Dec, 2014 1 commit
    • Damien George's avatar
      py: Allow builtins to be overridden. · 78d702c3
      Damien George authored
      This patch adds a configuration option (MICROPY_CAN_OVERRIDE_BUILTINS)
      which, when enabled, allows to override all names within the builtins
      module.  A builtins override dict is created the first time the user
      assigns to a name in the builtins model, and then that dict is searched
      first on subsequent lookups.  Note that this implementation doesn't
      allow deleting of names.
      
      This patch also does some refactoring of builtins code, creating the
      modbuiltins.c file.
      
      Addresses issue #959.
      78d702c3
  24. 29 Nov, 2014 1 commit
  25. 22 Nov, 2014 1 commit
  26. 16 Nov, 2014 1 commit
  27. 25 Oct, 2014 1 commit
  28. 23 Oct, 2014 1 commit
  29. 22 Oct, 2014 1 commit
  30. 12 Oct, 2014 1 commit
  31. 11 Oct, 2014 2 commits
  32. 09 Oct, 2014 1 commit
  33. 07 Oct, 2014 1 commit
  34. 29 Sep, 2014 1 commit
  35. 17 Sep, 2014 1 commit