cgen.py: use C type classes for _CodeGen._ft_c_type()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 9 Sep 2020 01:21:33 +0000 (21:21 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 9 Sep 2020 01:35:34 +0000 (21:35 -0400)
commit2d18e033c075573ff2544b7de39e48442ca72b33
tree7ee142fc34d447022f07eaee644ea8faa362a6d3
parentaa6b10cce94e568ae8c15efdcf03362c20825b27
cgen.py: use C type classes for _CodeGen._ft_c_type()

This patch introduces new classes to represent C types in `cgen.py`.

The C type class hierarchy is:

    _CType
      _ArithCType
      _PointerCType

A `_PointerCType` object contains another `_CType` object.

You can get the string representation of a C type object with its
__str__() method.

A C type constructor's `is_const` parameter controls whether or not the
_value_ is const. For example:

`const char *`:
    `_PointerCType` containing a const `_ArithCType`.

`const char * const`:
    Const `_PointerCType` containing a const `_ArithCType`.

_CodeGen._ft_c_type() now returns a `_CType` object instead of a string.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
barectf/cgen.py
barectf/templates/c/func-proto-params.j2
This page took 0.023074 seconds and 4 git commands to generate.