Spaces:
Sleeping
Sleeping
/* This part is from file 'cffi/parse_c_type.h'. It is copied at the | |
beginning of C sources generated by CFFI's ffi.set_source(). */ | |
typedef void *_cffi_opcode_t; | |
struct _cffi_global_s { | |
const char *name; | |
void *address; | |
_cffi_opcode_t type_op; | |
void *size_or_direct_fn; // OP_GLOBAL_VAR: size, or 0 if unknown | |
// OP_CPYTHON_BLTN_*: addr of direct function | |
}; | |
struct _cffi_getconst_s { | |
unsigned long long value; | |
const struct _cffi_type_context_s *ctx; | |
int gindex; | |
}; | |
struct _cffi_struct_union_s { | |
const char *name; | |
int type_index; // -> _cffi_types, on a OP_STRUCT_UNION | |
int flags; // _CFFI_F_* flags below | |
size_t size; | |
int alignment; | |
int first_field_index; // -> _cffi_fields array | |
int num_fields; | |
}; | |
// "standard layout" or if some are missing | |
struct _cffi_field_s { | |
const char *name; | |
size_t field_offset; | |
size_t field_size; | |
_cffi_opcode_t field_type_op; | |
}; | |
struct _cffi_enum_s { | |
const char *name; | |
int type_index; // -> _cffi_types, on a OP_ENUM | |
int type_prim; // _CFFI_PRIM_xxx | |
const char *enumerators; // comma-delimited string | |
}; | |
struct _cffi_typename_s { | |
const char *name; | |
int type_index; /* if opaque, points to a possibly artificial | |
OP_STRUCT which is itself opaque */ | |
}; | |
struct _cffi_type_context_s { | |
_cffi_opcode_t *types; | |
const struct _cffi_global_s *globals; | |
const struct _cffi_field_s *fields; | |
const struct _cffi_struct_union_s *struct_unions; | |
const struct _cffi_enum_s *enums; | |
const struct _cffi_typename_s *typenames; | |
int num_globals; | |
int num_struct_unions; | |
int num_enums; | |
int num_typenames; | |
const char *const *includes; | |
int num_types; | |
int flags; /* future extension */ | |
}; | |
struct _cffi_parse_info_s { | |
const struct _cffi_type_context_s *ctx; | |
_cffi_opcode_t *output; | |
unsigned int output_size; | |
size_t error_location; | |
const char *error_message; | |
}; | |
struct _cffi_externpy_s { | |
const char *name; | |
size_t size_of_result; | |
void *reserved1, *reserved2; | |
}; | |
static int parse_c_type(struct _cffi_parse_info_s *info, const char *input); | |
static int search_in_globals(const struct _cffi_type_context_s *ctx, | |
const char *search, size_t search_len); | |
static int search_in_struct_unions(const struct _cffi_type_context_s *ctx, | |
const char *search, size_t search_len); | |