A representation of a declaration in C. This is used to generate declarations in header files and (optionally) definitions in source files. Attributes: decl: C source code for the declaration. defn: Optionally, C source code for a definition. dependencies: The names o
| 97 | |
| 98 | |
| 99 | class HeaderDeclaration: |
| 100 | """A representation of a declaration in C. |
| 101 | |
| 102 | This is used to generate declarations in header files and |
| 103 | (optionally) definitions in source files. |
| 104 | |
| 105 | Attributes: |
| 106 | decl: C source code for the declaration. |
| 107 | defn: Optionally, C source code for a definition. |
| 108 | dependencies: The names of any objects that must be declared prior. |
| 109 | is_type: Whether the declaration is of a C type. (C types will be declared in |
| 110 | external header files and not marked 'extern'.) |
| 111 | needs_export: Whether the declared object needs to be exported to |
| 112 | other modules in the linking table. |
| 113 | """ |
| 114 | |
| 115 | def __init__( |
| 116 | self, |
| 117 | decl: str | list[str], |
| 118 | defn: list[str] | None = None, |
| 119 | *, |
| 120 | dependencies: set[str] | None = None, |
| 121 | is_type: bool = False, |
| 122 | needs_export: bool = False, |
| 123 | ) -> None: |
| 124 | self.decl = [decl] if isinstance(decl, str) else decl |
| 125 | self.defn = defn |
| 126 | self.dependencies = dependencies or set() |
| 127 | self.is_type = is_type |
| 128 | self.needs_export = needs_export |
| 129 | |
| 130 | |
| 131 | class EmitterContext: |
no outgoing calls
no test coverage detected
searching dependent graphs…