Skip to content
Snippets Groups Projects
  1. Feb 12, 2019
    • Damien George's avatar
      py: Downcase all MP_OBJ_IS_xxx macros to make a more consistent C API. · eee1e884
      Damien George authored
      These macros could in principle be (inline) functions so it makes sense to
      have them lower case, to match the other C API functions.
      
      The remaining macros that are upper case are:
      - MP_OBJ_TO_PTR, MP_OBJ_FROM_PTR
      - MP_OBJ_NEW_SMALL_INT, MP_OBJ_SMALL_INT_VALUE
      - MP_OBJ_NEW_QSTR, MP_OBJ_QSTR_VALUE
      - MP_OBJ_FUN_MAKE_SIG
      - MP_DECLARE_CONST_xxx
      - MP_DEFINE_CONST_xxx
      
      These must remain macros because they are used when defining const data (at
      least, MP_OBJ_NEW_SMALL_INT is so it makes sense to have
      MP_OBJ_SMALL_INT_VALUE also a macro).
      
      For those macros that have been made lower case, compatibility macros are
      provided for the old names so that users do not need to change their code
      immediately.
      eee1e884
  2. Oct 04, 2017
    • Damien George's avatar
      all: Remove inclusion of internal py header files. · a3dc1b19
      Damien George authored
      Header files that are considered internal to the py core and should not
      normally be included directly are:
          py/nlr.h - internal nlr configuration and declarations
          py/bc0.h - contains bytecode macro definitions
          py/runtime0.h - contains basic runtime enums
      
      Instead, the top-level header files to include are one of:
          py/obj.h - includes runtime0.h and defines everything to use the
              mp_obj_t type
          py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h,
              and defines everything to use the general runtime support functions
      
      Additional, specific headers (eg py/objlist.h) can be included if needed.
      a3dc1b19
  3. Jul 31, 2017
  4. Jul 21, 2017
  5. Mar 29, 2017
  6. Mar 28, 2017
  7. Mar 14, 2017
    • Damien George's avatar
      py: Allow lexer to raise exceptions during construction. · 1831034b
      Damien George authored
      This patch refactors the error handling in the lexer, to simplify it (ie
      reduce code size).
      
      A long time ago, when the lexer/parser/compiler were first written, the
      lexer and parser were designed so they didn't use exceptions (ie nlr) to
      report errors but rather returned an error code.  Over time that has
      gradually changed, the parser in particular has more and more ways of
      raising exceptions.  Also, the lexer never really handled all errors without
      raising, eg there were some memory errors which could raise an exception
      (and in these rare cases one would get a fatal nlr-not-handled fault).
      
      This patch accepts the fact that the lexer can raise exceptions in some
      cases and allows it to raise exceptions to handle all its errors, which are
      for the most part just out-of-memory errors during construction of the
      lexer.  This makes the lexer a bit simpler, and also the persistent code
      stuff is simplified.
      
      What this means for users of the lexer is that calls to it must be wrapped
      in a nlr handler.  But all uses of the lexer already have such an nlr
      handler for the parser (and compiler) so that doesn't put any extra burden
      on the callers.
      1831034b
  8. Oct 17, 2016
  9. Jan 11, 2016
  10. Dec 18, 2015
    • Damien George's avatar
      py: Add MICROPY_ENABLE_COMPILER and MICROPY_PY_BUILTINS_EVAL_EXEC opts. · dd5353a4
      Damien George authored
      MICROPY_ENABLE_COMPILER can be used to enable/disable the entire compiler,
      which is useful when only loading of pre-compiled bytecode is supported.
      It is enabled by default.
      
      MICROPY_PY_BUILTINS_EVAL_EXEC controls support of eval and exec builtin
      functions.  By default they are only included if MICROPY_ENABLE_COMPILER
      is enabled.
      
      Disabling both options saves about 40k of code size on 32-bit x86.
      dd5353a4
  11. Nov 29, 2015
    • Damien George's avatar
      py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR. · 999cedb9
      Damien George authored
      This allows the mp_obj_t type to be configured to something other than a
      pointer-sized primitive type.
      
      This patch also includes additional changes to allow the code to compile
      when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of
      mp_uint_t, and various casts.
      999cedb9
  12. Feb 15, 2015
  13. Jan 20, 2015
  14. Jan 01, 2015
  15. Dec 19, 2014
  16. Oct 25, 2014
  17. Oct 05, 2014
  18. Sep 23, 2014
    • Damien George's avatar
      py: Free non-interned strings in the parser when not needed. · 52b5d76a
      Damien George authored
      mp_parse_node_free now frees the memory associated with non-interned
      strings.  And the parser calls mp_parse_node_free when discarding a
      non-used node (such as a doc string).
      
      Also, the compiler now frees the parse tree explicitly just before it
      exits (as opposed to relying on the caller to do this).
      
      Addresses issue #708 as best we can.
      52b5d76a
  19. Aug 30, 2014
  20. 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
  21. May 02, 2014
  22. Apr 13, 2014
  23. Apr 06, 2014
  24. Apr 05, 2014
  25. Mar 30, 2014
    • Damien George's avatar
      Merge map.h into obj.h. · df6567e6
      Damien George authored
      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.
      df6567e6
    • Damien George's avatar
      Rename rt_* to mp_*. · d17926db
      Damien George authored
      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.
      d17926db
  26. Mar 17, 2014
    • xbe's avatar
      py: Clean up includes. · efe34223
      xbe authored
      Remove unnecessary includes. Add includes that improve portability.
      efe34223
  27. Feb 15, 2014
    • Damien George's avatar
      Implement proper exception type hierarchy. · c5966128
      Damien George authored
      Each built-in exception is now a type, with base type BaseException.
      C exceptions are created by passing a pointer to the exception type to
      make an instance of.  When raising an exception from the VM, an
      instance is created automatically if an exception type is raised (as
      opposed to an exception instance).
      
      Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper.
      
      Handling of parse error changed to match new exceptions.
      
      mp_const_type renamed to mp_type_type for consistency.
      c5966128
  28. Feb 12, 2014
  29. Feb 08, 2014
  30. Feb 03, 2014
  31. Jan 25, 2014
  32. Jan 22, 2014
  33. Jan 21, 2014
  34. Jan 18, 2014
  35. Jan 15, 2014
Loading