Skip to content
Snippets Groups Projects
  1. Sep 17, 2017
    • Paul Sokolovsky's avatar
      py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS. · 9dce823c
      Paul Sokolovsky authored
      This allows user classes to implement __abs__ special method, and saves
      code size (104 bytes for x86_64), even though during refactor, an issue
      was fixed and few optimizations were made:
      
      * abs() of minimum (negative) small int value is calculated properly.
      * objint_longlong and objint_mpz avoid allocating new object is the
        argument is already non-negative.
      9dce823c
  2. Aug 29, 2017
  3. Jul 31, 2017
  4. Jul 18, 2017
    • Alexander Steffen's avatar
      all: Unify header guard usage. · 299bc625
      Alexander Steffen authored
      The code conventions suggest using header guards, but do not define how
      those should look like and instead point to existing files. However, not
      all existing files follow the same scheme, sometimes omitting header guards
      altogether, sometimes using non-standard names, making it easy to
      accidentally pick a "wrong" example.
      
      This commit ensures that all header files of the MicroPython project (that
      were not simply copied from somewhere else) follow the same pattern, that
      was already present in the majority of files, especially in the py folder.
      
      The rules are as follows.
      
      Naming convention:
      * start with the words MICROPY_INCLUDED
      * contain the full path to the file
      * replace special characters with _
      
      In addition, there are no empty lines before #ifndef, between #ifndef and
      one empty line before #endif. #endif is followed by a comment containing
      the name of the guard macro.
      
      py/grammar.h cannot use header guards by design, since it has to be
      included multiple times in a single C file. Several other files also do not
      need header guards as they are only used internally and guaranteed to be
      included only once:
      * MICROPY_MPHALPORT_H
      * mpconfigboard.h
      * mpconfigport.h
      * mpthreadport.h
      * pin_defs_*.h
      * qstrdefs*.h
      299bc625
  5. Apr 04, 2017
  6. Feb 02, 2017
  7. Jan 21, 2017
  8. Dec 21, 2016
  9. Oct 11, 2016
  10. Jan 07, 2016
  11. Apr 25, 2015
  12. Apr 16, 2015
    • 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
  13. Mar 14, 2015
  14. Jan 24, 2015
  15. Jan 01, 2015
  16. Oct 03, 2014
  17. Sep 15, 2014
    • 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
  18. Aug 29, 2014
  19. Jul 24, 2014
  20. May 17, 2014
  21. May 03, 2014
    • Damien George's avatar
      Add license header to (almost) all files. · 04b9147e
      Damien George authored
      Blanket wide to all .c and .h files.  Some files originating from ST are
      difficult to deal with (license wise) so it was left out of those.
      
      Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
      04b9147e
  22. Apr 08, 2014
    • Damien George's avatar
      py: Make it so that printing a small int does not allocate heap memory. · 88d7bba9
      Damien George authored
      With the implementation of proper string formatting, code to print a
      small int was delegated to mpz_as_str_inpl (after first converting the
      small int to an mpz using stack memory).  But mpz_as_str_inpl allocates
      heap memory to do the conversion, so small ints needed heap memory just
      to be printed.
      
      This fix has a separate function to print small ints, which does not
      allocate heap, and allocates less stack.
      
      String formatting, printf and pfenv are now large beasts, with some
      semi-duplicated code.
      88d7bba9
  23. Apr 07, 2014
  24. Apr 04, 2014
  25. Feb 22, 2014
  26. Feb 15, 2014
  27. Feb 14, 2014
  28. Jan 27, 2014
  29. Jan 15, 2014
  30. Jan 13, 2014
Loading