summaryrefslogtreecommitdiffstatshomepage
path: root/unix/modffi.c
Commit message (Collapse)AuthorAge
* unix: Use mp_raise_OSError helper function.Damien George2016-10-07
|
* all: Remove 'name' member from mp_obj_module_t struct.Damien George2016-09-22
| | | | One can instead lookup __name__ in the modules dict to get the value.
* unix/modffi: Allow to compile modffi in OBJ_REPR_D mode.Damien George2016-01-15
|
* py: Change first arg of type.make_new from mp_obj_t to mp_obj_type_t*.Damien George2016-01-11
| | | | | | | | The first argument to the type.make_new method is naturally a uPy type, and all uses of this argument cast it directly to a pointer to a type structure. So it makes sense to just have it a pointer to a type from the very beginning (and a const pointer at that). This patch makes such a change, and removes all unnecessary casting to/from mp_obj_t.
* py: Change type signature of builtin funs that take variable or kw args.Damien George2016-01-11
| | | | | With this patch the n_args parameter is changed type from mp_uint_t to size_t.
* py: Change type of .make_new and .call args: mp_uint_t becomes size_t.Damien George2016-01-11
| | | | | | | This patch changes the type signature of .make_new and .call object method slots to use size_t for n_args and n_kw (was mp_uint_t. Makes code more efficient when mp_uint_t is larger than a machine word. Doesn't affect ports when size_t and mp_uint_t have the same size.
* py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.Damien George2015-11-29
| | | | | | | | | 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.
* py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George2015-11-29
|
* unix/modffi: Mark 'O' type specifier as implemented.Paul Sokolovsky2015-11-20
|
* unix/modffi.c: cast first to intptr_t when casting from/to pointerVicente Olivert Riera2015-09-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes errors like these ones: modffi.c: In function 'return_ffi_value': modffi.c:143:29: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] const char *s = (const char *)val; ^ modffi.c:162:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] return (mp_obj_t)val; ^ modffi.c: In function 'ffifunc_call': modffi.c:358:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] values[i] = (ffi_arg)a; ^ modffi.c:373:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] values[i] = (ffi_arg)s; ^ modffi.c:381:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] values[i] = (ffi_arg)bufinfo.buf; ^ modffi.c:384:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] values[i] = (ffi_arg)p->func; ^ These errors can be highlighted when building micropython from MIPS64 n32 because ffi_arg is 64-bit wide and the pointers on MIPS64 n32 are 32-bit wide, so it's trying to case an integer to a pointer (or vice-versa) of a different size. We should cast first the pointer (or the integer) to a pointer sized integer (intptr_t) to fix that problem. Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
* modffi: dlsym() doesn't set errno, so use ENOENT for OSError.Paul Sokolovsky2015-08-31
| | | | | This may be a bit confusing, as ENOENT is often rendered as "No such file or directory", but any other code would be only more confusing.
* unix/modffi.c: get_buffer is allowed to return NULL if len=0.Damien George2015-05-01
| | | | | This is consistent with the logic in mp_get_buffer, and the code here is an inlined version of that function.
* unix/modffi: Support passing float/double args.Damien George2015-04-28
|
* py: Overhaul and simplify printf/pfenv mechanism.Damien George2015-04-16
| | | | | | | | | | | | | | | | | | | | | | 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.
* modffi: Implement 'O' type handling for func arguments.Paul Sokolovsky2015-02-25
|
* modffi: Add toplevel func() function to create a function by pointer.Paul Sokolovsky2015-02-11
|
* modffi: Add .addr() method to just get symbol address.Paul Sokolovsky2015-02-06
|
* modffi: 's' (string) return type: handle NULL properly (return None).Paul Sokolovsky2015-01-25
|
* modffi: Support return values of mp_obj_t type.Paul Sokolovsky2015-01-22
|
* modffi: Support open own executable using open(None).Paul Sokolovsky2015-01-21
|
* py, unix: Allow to compile with -Wunused-parameter.Damien George2015-01-20
| | | | See issue #699.
* py, unix: Allow to compile with -Wsign-compare.Damien George2015-01-16
| | | | See issue #699.
* unix: Allow to compile with float support disabled.Damien George2015-01-08
|
* unix: Prefix includes with py/; remove need for -I../py.Damien George2015-01-01
|
* modffi: Support void (None) return value for Python callback functions.Paul Sokolovsky2014-12-16
|
* modffi: 64-bit cleanness (fixes actual bug in callback arg handling).Paul Sokolovsky2014-12-15
|
* py: Make functions static where appropriate.Damien George2014-12-10
|
* py: Rename mp_obj_int_get to mp_obj_int_get_truncated; fix struct.pack.Damien George2014-12-05
| | | | | | | | | | | mp_obj_int_get_truncated is used as a "fast path" int accessor that doesn't check for overflow and returns the int truncated to the machine word size, ie mp_int_t. Use mp_obj_int_get_truncated to fix struct.pack when packing maximum word sized values. Addresses issues #779 and #998.
* Use MP_DEFINE_CONST_DICT macro to define module dicts.Damien George2014-11-29
| | | | | This is just a clean-up of the code. Generated code is exactly the same.
* unix: Fix modffi to be able to return double on x86 machines.Damien George2014-09-06
|
* unix: Don't use -Wno-error=cpp or #warning; fix strict alias warning.Damien George2014-09-06
| | | | | | | | | | For the sake of older versions of gcc (and other compilers), don't use the #warning CPP directive, nor the -Wno-error=cpp option. Also, fix a strict alias warning in modffi.c for older compilers, and add a test for ffi module. Addresses issue #847.
* py: Change all uint to mp_uint_t in obj.h.Damien George2014-08-30
| | | | Part of code cleanup, working towards resolving issue #50.
* Change some parts of the core API to use mp_uint_t instead of uint/int.Damien George2014-08-30
| | | | Addressing issue #50, still some way to go yet.
* py: Make MP_OBJ_NEW_SMALL_INT cast arg to mp_int_t itself.Damien George2014-07-31
| | | | Addresses issue #724.
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* modffi: Add special 'C' code for passing a callback function pointer.Paul Sokolovsky2014-07-01
|
* modffi: Support short types.Paul Sokolovsky2014-06-29
|
* Prefix ARRAY_SIZE with micropython prefix MP_Emmanuel Blot2014-06-19
|
* Change const byte* to const char* where sensible.Damien George2014-05-25
| | | | | This removes need for some casts (at least, more than it adds need for new casts!).
* py, unix: Add copyright for modules I worked closely on.Paul Sokolovsky2014-05-13
|
* 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/.
* unix,stmhal: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky2014-05-02
|
* Add ARRAY_SIZE macro, and use it where possible.Damien George2014-04-26
|
* unix: Workaround MP_OBJ_NEW_SMALL_INT() 64-bit issues.Paul Sokolovsky2014-04-22
|
* unix: OSError's args[0] should be errno numeric value.Paul Sokolovsky2014-04-22
| | | | Well, Python3 also defines an attribute for that, but that's bloat.
* modffi: Don't use OSError for clearly unrelated errors.Paul Sokolovsky2014-04-22
|
* modffi: Describe typecodes where they differ from used by struct module.Paul Sokolovsky2014-04-22
| | | | Exact behavior of typecodes may be not yet enforced.
* modffi: Update for MP_OBJ_STOP_ITERATION refactor.Paul Sokolovsky2014-04-19
|
* modffi: Mark 'p' type spec deprecated, replace with 'P'.Paul Sokolovsky2014-04-19
| | | | 'p' in struct module is "pascal string". 'P' is void*.
* unix: Update to use new buffer protocol interface with typecode.Damien George2014-04-18
|