StatementΒΆ

var = CVariable("u32My_var", Cuint32, initial_value=5)
array = CArray("u8My_array", Cuint8, length=10)
statements = CStatements([
    var.declare(),
    array.declare(),

    # Statements can also contain other statements
    CStatements([
        CVariable("u8Var", Cuint8, initial_value=3).declare()
    ])
])
print(statements.render())
uint32_t u32My_var = 5;
uint8_t u8My_array[10];
uint8_t u8Var = 3;
fun = CFunction("my_fun")
declarations = CDeclarations([
    # Declarations include declarations and definitions of variable, function, class... etc
    # But not other statements (if, while, ...)
    fun.declare(),
    fun.define()
])

print(declarations.render())
void my_fun(void);
void my_fun(void)
{

};