modffi: Add special 'C' code for passing a callback function pointer.

This commit is contained in:
Paul Sokolovsky 2014-07-01 01:57:08 +03:00
parent 4039a26679
commit e95b6b5e07
1 changed files with 5 additions and 0 deletions

View File

@ -51,6 +51,10 @@
* s - as argument, the same as "p", as return value, causes string * s - as argument, the same as "p", as return value, causes string
* to be allocated and returned, instead of pointer value. * to be allocated and returned, instead of pointer value.
* *
* TODO:
* O - mp_obj_t, passed as is (mostly useful as callback param)
* C - callback function
*
* Note: all constraint specified by typecode can be not enforced at this time, * Note: all constraint specified by typecode can be not enforced at this time,
* but may be later. * but may be later.
*/ */
@ -108,6 +112,7 @@ STATIC ffi_type *char2ffi_type(char c)
case 'L': return &ffi_type_ulong; case 'L': return &ffi_type_ulong;
case 'f': return &ffi_type_float; case 'f': return &ffi_type_float;
case 'd': return &ffi_type_double; case 'd': return &ffi_type_double;
case 'C': // (*)()
case 'P': // const void* case 'P': // const void*
case 'p': // void* case 'p': // void*
case 's': return &ffi_type_pointer; case 's': return &ffi_type_pointer;