summaryrefslogtreecommitdiffstatshomepage
path: root/py/objfun.c
Commit message (Collapse)AuthorAge
* py: Tidy up returning NULL which should be MP_OBJ_NOT_SUPPORTED.Damien George2014-05-10
|
* py: Combine native emitters to 1 glue function; distinguish viper.Damien George2014-05-10
| | | | | | | | This patch simplifies the glue between native emitter and runtime, and handles viper code like inline assember: return values are converted to Python objects. Fixes issue #531.
* py: Rename byte_code to bytecode everywhere.Damien George2014-05-10
| | | | bytecode is the more widely used. See issue #590.
* Add license header to (almost) all files.Damien George2014-05-03
| | | | | | | 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/.
* Merge pull request #552 from stinos/mingw-allocaPaul Sokolovsky2014-05-03
|\ | | | | py: Use <alloca.h> for alloca()
| * py: Use <alloca.h> for alloca()stijn2014-05-03
| | | | | | | | | | | | | | | | alloca() is declared in alloca.h which als happens to be included by stdlib.h. On mingw however it resides in malloc.h only. So if we include alloca.h directly, and add an alloca.h for mingw in it's port directory we can get rid of the mingw-specific define to include malloc.h and the other ports are happy as well.
* | objclosure, objcell: Print detailed representation if was requested.Paul Sokolovsky2014-05-03
|/ | | | | Well, it is bound to "detailed error reporting", but that's closest what we have now without creating new entities.
* py, unix: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky2014-05-02
| | | | Specifically, nlr.h does.
* objfun: More debug logging.Paul Sokolovsky2014-05-01
|
* objgenerator: Fix check for too few args passed to gen function.Paul Sokolovsky2014-05-01
|
* objgenerator: .print(): Output real underlying function name.Paul Sokolovsky2014-05-01
|
* py: Add tentative scheme for error messages configuration.Paul Sokolovsky2014-05-01
|
* objfun: Add function name accessor and .print slot method.Paul Sokolovsky2014-05-01
|
* objfun: Factor out function to report positional args mismatch.Paul Sokolovsky2014-04-30
|
* py: Implement keyword-only args.Damien George2014-04-27
| | | | | | | Implements 'def f(*, a)' and 'def f(*a, b)', but not default keyword-only args, eg 'def f(*, a=1)'. Partially addresses issue #524.
* py: Add win32-specific header for alloca().Paul Sokolovsky2014-04-20
|
* py: Add arg checking helper functions.Damien George2014-04-20
| | | | | | | These are to assist in writing native C functions that take positional and keyword arguments. mp_arg_check_num is for just checking the number of arguments is correct. mp_arg_parse_all is for parsing positional and keyword arguments with default values.
* py: Allow to pass buffer protocol flags to get_buffer helper funcs.Damien George2014-04-18
|
* py: Add typecode to buffer protocol.Damien George2014-04-18
| | | | | | | When querying an object that supports the buffer protocol, that object must now return a typecode (as per binary.[ch]). This does not have to be honoured by the caller, but can be useful for determining element size.
* py: Tidy up function argument error messages.Damien George2014-04-18
| | | | We are not as verbose as CPython, and maybe a bit too cryptic sometimes.
* py: Simplify objfun/objgenerator connection, no need to call bc_get.Damien George2014-04-17
|
* objfun: Add local header.Paul Sokolovsky2014-04-17
| | | | | | | | | This follows pattern already used for objtuple, etc.: objfun.h's content is not public - each and every piece of code should not have access to it. It's not private either - with out architecture and implementation language (C) it doesn't make sense to keep implementation of each object strictly private and maintain cumbersome accessors. It's "local" - intended to be used by a small set of "friend" (in C++ terms) objects.
* py: Fix mp_get_buffer, and use it in more places.Damien George2014-04-13
| | | | | Must use mp_obj_get_type to get the type of an object. Can't assume mp_obj_t is castable to mp_obj_base_t.
* py: Provide more details for too few and too much args for Python fun calls.Paul Sokolovsky2014-04-13
|
* py: Big improvements to inline assembler.Damien George2014-04-13
| | | | | | | | | Improved the Thumb assembler back end. Added many more Thumb instructions to the inline assembler. Improved parsing of assembler instructions and arguments. Assembler functions can now be passed the address of any object that supports the buffer protocol (to get the address of the buffer). Added an example of how to sum numbers from an array in assembler.
* py: Change compile order for default positional and keyword args.Damien George2014-04-11
| | | | | | | | | | | This simplifies the compiler a little, since now it can do 1 pass over a function declaration, to determine default arguments. I would have done this originally, but CPython 3.3 somehow had the default keyword args compiled before the default position args (even though they appear in the other order in the text of the script), and I thought it was important to have the same order of execution when evaluating default arguments. CPython 3.4 has changed the order to the more obvious one, so we can also change.
* objfun: Fix default arguments filling loop, was broken in presense of kwargs.Paul Sokolovsky2014-04-10
|
* objfun: More debug logging when calling a bytecode function.Paul Sokolovsky2014-04-10
|
* py: Make globals and locals proper dictionary objects.Damien George2014-04-05
| | | | | | | | | | | Finishes addressing issue #424. In the end this was a very neat refactor that now makes things a lot more consistent across the py code base. It allowed some simplifications in certain places, now that everything is a dict object. Also converted builtins tables to dictionaries. This will be useful when we need to turn builtins into a proper module.
* py: Change nlr_jump to nlr_raise, to aid in debugging.Damien George2014-04-05
| | | | | | This does not affect code size or performance when debugging turned off. To address issue #420.
* objfun: Add equality support.Paul Sokolovsky2014-04-05
|
* py: Disable dump_args function call entirely when not debugging.Damien George2014-03-31
| | | | | Yes, I know, a good compiler will optimise this away, but I feel this is neater.
* objgenerator: Handle default args to generator functions.Paul Sokolovsky2014-03-30
| | | | Addresses #397.
* Merge map.h into obj.h.Damien George2014-03-30
| | | | | | 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.
* Rename rt_* to mp_*.Damien George2014-03-30
| | | | | | | 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.
* py: Rename old const type objects to mp_type_* for consistency.Damien George2014-03-29
|
* py: Change mp_const_* objects to macros.Damien George2014-03-29
| | | | Addresses issue #388.
* py: Put n_state for bytecode in the bytecode prelude.Damien George2014-03-27
| | | | | | | | | | | Rationale: setting up the stack (state for locals and exceptions) is really part of the "code", it's the prelude of the function. For example, native code adjusts the stack pointer on entry to the function. Native code doesn't need to know n_state for any other reason. So putting the state size in the bytecode prelude is sensible. It reduced ROM usage on STM by about 30 bytes :) And makes it easier to pass information about the bytecode between functions.
* py: Clean up includes.xbe2014-03-17
| | | | Remove unnecessary includes. Add includes that improve portability.
* Implement ROMable modules. Add math module.Damien George2014-03-08
| | | | | | | | | | mp_module_obj_t can now be put in ROM. Configuration of float type is now similar to longint: can now choose none, float or double as the implementation. math module has basic math functions. For STM port, these are not yet implemented (they are just stub functions).
* py: Fix overriding of default arguments.Damien George2014-03-03
| | | | Addresses issue #327.
* py: Remove more var arg names fro macros with var args.Damien George2014-02-26
|
* py: Reduce size of mp_obj_fun_native_t struct by packing ints.Damien George2014-02-26
|
* py: Take out bitfield entries from their own structure.Damien George2014-02-26
| | | | | Don't need to wrap bitfields in their own struct. Compiler does the correct thing without it.
* Add pin mapping code.Dave Hylands2014-02-17
| | | | | | | | | | | | | | | | | | | | | | | This commit also introduces board directories and moves board specific config into the appropriate board directory. boards/stm32f4xx-af.csv was extracted from the STM32F4xx datasheet and hand-tweaked. make-pins.py takes boards/stm32f4xx-af.csv, boards/stm32f4xx-prefix.c, and boards/BOARD-NAME/pins.csv as input and generates the file build/pins_BOARD_NAME.c The generated pin file for PYBOARD4 looks like this: https://gist.github.com/dhylands/9063231 The generated pins file includes all of the supported alternate functions, and includes upsupported alternate functions as comments. See the commnet block at the top of stm/pin_map.c for details on how to use the pin mapper. I also went ahead and modified stm/gpio.c to use the pin mapper.
* Support passing positional args as keywords to bytecode functions.Paul Sokolovsky2014-02-16
| | | | | For this, record argument names along with each bytecode function. The code still includes extensive debug logging support so far.
* py: Pass keyword arguments to byte code.Damien George2014-02-16
|
* py: Implement *vargs support.Damien George2014-02-16
| | | | Addresses issue #295.
* py: VM never throws an exception, instead returns a status and value.Damien George2014-02-15
| | | | | Addresses issue #290, and hopefully sets up things to allow generators throwing exceptions, etc.
* Implement proper exception type hierarchy.Damien George2014-02-15
| | | | | | | | | | | | | | 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.