Utilities

Module for extracting cython headers from the fly capture c headers. For example:

header = r'E:\Point Grey Research\FlyCapture2\include\FlyCapture2_C'
content = parse_header('{}.h'.format(header))
dump_cython(content, '{}.h'.format(header), '{}.pxi'.format(header))
class pyflycap2.utils.EnumMemberSpec(name, value)

Bases: tuple

Represents a c enum member.

name
value
class pyflycap2.utils.EnumSpec(tp_name, names, values)

Bases: tuple

Represents a c enum definition.

names
tp_name
values
class pyflycap2.utils.FunctionSpec(dec, type, pointer, name, args)

Bases: tuple

Represents a c function prototype.

args
dec
name
pointer
type
class pyflycap2.utils.StructSpec(tp_name, names, members)

Bases: tuple

Represents a c struct definition.

members
names
tp_name
class pyflycap2.utils.TypeDef(body)

Bases: tuple

Represents a c typedef.

body
class pyflycap2.utils.VariableSpec(type, pointer, name, count)

Bases: tuple

Represents a variable declaration in e.g. the definition of a function or its return value.

count
name
pointer
type
pyflycap2.utils.dump_cython(content, name, ofile)

Generates a cython pxi file from the output of parse_header().

pyflycap2.utils.format_enum(enum_def)

Returns a cython enum from a EnumSpec instance.

pyflycap2.utils.format_function(function)

Returns a cython function from a FunctionSpec instance.

pyflycap2.utils.format_struct(struct_def)

Returns a cython struct from a StructSpec instance.

pyflycap2.utils.format_typedef(typedef)

Generates a cython typedef from a TypeDef instance.

pyflycap2.utils.format_variable(variable)

Returns a cython variable from a VariableSpec instance.

pyflycap2.utils.parse_enum(type_name, body, name)

Returns a EnumSpec instance from the input.

pyflycap2.utils.parse_header(filename)

Returns a list of VariableSpec, FunctionSpec, StructSpec, EnumSpec, EnumMemberSpec, and TypeDef instances representing the c header file.

pyflycap2.utils.parse_prototype(prototype)

Returns a FunctionSpec instance from the input.

pyflycap2.utils.parse_struct(type_name, body, name)

Returns a StructSpec instance from the input.

pyflycap2.utils.strip_comments(code)

Returns the headers with comments removed.