FunctionΒΆ
f = CFunction(
name="examplefun",
return_type=Cuint32,
static=True,
arguments=[
CFunction.Argument(name="first", c_type=Cuint32, doc=Doc("First argument")),
CFunction.Argument(name="second", c_type=Cdouble, default=CLiteral(2), doc=Doc("Second Argument"))
],
doc=Doc("Awesome function", "This function is awesome because it does marvellous things",
ret="returns a lucky number"),
content=CStatements([
CVariable("local_var", Cint8).declare()
])
)
print(f.declare().render())
/**
* @brief Awesome function
*
* This function is awesome because it does marvellous things
* @param first First argument
* @param second Second Argument
* @return returns a lucky number
*/
static uint32_t
examplefun(uint32_t first, double second = 2);
print(f.define().render())
static uint32_t examplefun(uint32_t first, double second)
{
int8_t local_var;
}