Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
88972b0d
Commit
88972b0d
authored
Apr 21, 2014
by
Paul Sokolovsky
Browse files
modffi: Describe typecodes where they differ from used by struct module.
Exact behavior of typecodes may be not yet enforced.
parent
ca045d97
Changes
1
Hide whitespace changes
Inline
Side-by-side
unix/modffi.c
View file @
88972b0d
...
...
@@ -12,6 +12,22 @@
#include
"runtime.h"
#include
"binary.h"
/*
* modffi uses character codes to encode a value type, based on "struct"
* module type codes, with some extensions and overridings.
*
* Extra/overridden typecodes:
* v - void, can be used only as return type
* P - const void*, pointer to read-only memory
* p - void*, meaning pointer to a writable memory (note that this
* clashes with struct's "p" as "Pascal string").
* s - as argument, the same as "p", as return value, causes string
* to be allocated and returned, instead of pointer value.
*
* Note: all constraint specified by typecode can be not enforced at this time,
* but may be later.
*/
typedef
struct
_mp_obj_opaque_t
{
mp_obj_base_t
base
;
void
*
val
;
...
...
@@ -63,8 +79,8 @@ STATIC ffi_type *char2ffi_type(char c)
case
'L'
:
return
&
ffi_type_ulong
;
case
'f'
:
return
&
ffi_type_float
;
case
'd'
:
return
&
ffi_type_double
;
case
'
p
'
:
//
Deprecated - conflicts with struct module
case
'
P
'
:
case
'
P
'
:
//
const void*
case
'
p
'
:
// void*
case
's'
:
return
&
ffi_type_pointer
;
case
'v'
:
return
&
ffi_type_void
;
default:
return
NULL
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment