1. 08 May, 2015 1 commit
  2. 07 May, 2015 1 commit
  3. 28 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. 21 Mar, 2015 1 commit
  6. 13 Mar, 2015 1 commit
  7. 07 Feb, 2015 1 commit
    • Damien George's avatar
      py: Protect mp_parse and mp_compile with nlr push/pop block. · 0bfc7638
      Damien George authored
      To enable parsing constants more efficiently, mp_parse should be allowed
      to raise an exception, and mp_compile can already raise a MemoryError.
      So these functions need to be protected by an nlr push/pop block.
      
      This patch adds that feature in all places.  This allows to simplify how
      mp_parse and mp_compile are called: they now raise an exception if they
      have an error and so explicit checking is not needed anymore.
      0bfc7638
  8. 20 Jan, 2015 1 commit
  9. 16 Jan, 2015 2 commits
  10. 12 Jan, 2015 1 commit
  11. 07 Jan, 2015 1 commit
  12. 01 Jan, 2015 1 commit
  13. 29 Dec, 2014 1 commit
  14. 18 Dec, 2014 1 commit
  15. 10 Dec, 2014 1 commit
  16. 08 Dec, 2014 1 commit
    • Paul Sokolovsky's avatar
      modsys: Add sys.print_exception(exc, file=sys.stdout) function. · 46c3ab20
      Paul Sokolovsky authored
      The function is modeled after traceback.print_exception(), but unbloated,
      and put into existing module to save overhead on adding another module.
      Compliant traceback.print_exception() is intended to be implemented in
      micropython-lib in terms of sys.print_exception().
      
      This change required refactoring mp_obj_print_exception() to take pfenv_t
      interface arguments.
      
      Addresses #751.
      46c3ab20
  17. 05 Dec, 2014 1 commit
    • Damien George's avatar
      py: Optimise lexer by exposing lexer type. · a4c52c5a
      Damien George authored
      mp_lexer_t type is exposed, mp_token_t type is removed, and simple lexer
      functions (like checking current token kind) are now inlined.
      
      This saves 784 bytes ROM on 32-bit unix, 348 bytes on stmhal, and 460
      bytes on bare-arm.  It also saves a tiny bit of RAM since mp_lexer_t
      is a bit smaller.  Also will run a bit more efficiently.
      a4c52c5a
  18. 01 Dec, 2014 1 commit
  19. 05 Nov, 2014 1 commit
  20. 26 Oct, 2014 2 commits
  21. 25 Oct, 2014 3 commits
  22. 24 Oct, 2014 1 commit
  23. 17 Oct, 2014 1 commit
  24. 09 Oct, 2014 1 commit
  25. 05 Oct, 2014 1 commit
  26. 03 Oct, 2014 1 commit
  27. 01 Oct, 2014 1 commit
  28. 25 Sep, 2014 1 commit
  29. 15 Sep, 2014 1 commit
    • Damien George's avatar
      py: Move definition of mp_sys_exit to core. · b92cbe61
      Damien George authored
      sys.exit always raises SystemExit so doesn't need a special
      implementation for each port.  If C exit() is really needed, use the
      standard os._exit function.
      
      Also initialise mp_sys_path and mp_sys_argv in teensy port.
      b92cbe61
  30. 30 Aug, 2014 2 commits
  31. 24 Aug, 2014 1 commit
  32. 16 Aug, 2014 1 commit
  33. 04 Aug, 2014 1 commit
  34. 28 Jul, 2014 1 commit
  35. 25 Jul, 2014 1 commit
    • Dave Hylands's avatar
      Add support for storing args during an exception raised by an irq. · 5b7fd20f
      Dave Hylands authored
      The user code should call micropython.alloc_emergency_exception_buf(size)
      where size is the size of the buffer used to print the argument
      passed to the exception.
      
      With the test code from #732, and a call to
      micropython.alloc_emergenncy_exception_buf(100) the following error is
      now printed:
      ```python
      >>> import heartbeat_irq
      Uncaught exception in Timer(4) interrupt handler
      Traceback (most recent call last):
        File "0://heartbeat_irq.py", line 14, in heartbeat_cb
      NameError: name 'led' is not defined
      ```
      5b7fd20f