Top-level container for the clang-AST scrape output. Serialised to ``Scripts/introspect_snapshot.json``. snapshot_version bumps on schema-incompatible changes. ``hand_enums`` mirrors ``enums`` but covers URLab's hand-rolled ``EMj*`` enums under ``Source/URLab/Public``. They live in
| 121 | |
| 122 | @dataclass |
| 123 | class IntrospectSnapshot: |
| 124 | """Top-level container for the clang-AST scrape output. Serialised |
| 125 | to ``Scripts/introspect_snapshot.json``. snapshot_version bumps on |
| 126 | schema-incompatible changes. |
| 127 | |
| 128 | ``hand_enums`` mirrors ``enums`` but covers URLab's hand-rolled |
| 129 | ``EMj*`` enums under ``Source/URLab/Public``. They live in a |
| 130 | separate field so the MuJoCo mjt* lookup (value_map.mj_const drift |
| 131 | checks) doesn't accidentally collide with a future EMj* name.""" |
| 132 | snapshot_version: int = 1 |
| 133 | header_hash: str = "" |
| 134 | functions: Dict[str, CFunction] = field(default_factory=dict) |
| 135 | enums: Dict[str, CEnum] = field(default_factory=dict) |
| 136 | structs: Dict[str, CStruct] = field(default_factory=dict) |
| 137 | defines: Dict[str, CDefine] = field(default_factory=dict) |
| 138 | hand_enums: Dict[str, CEnum] = field(default_factory=dict) |
| 139 | |
| 140 | def to_dict(self) -> Dict[str, Any]: |
| 141 | return { |
| 142 | "_meta": { |
| 143 | "snapshot_version": self.snapshot_version, |
| 144 | "header_hash": self.header_hash, |
| 145 | }, |
| 146 | "functions": {n: f.to_dict() for n, f in self.functions.items()}, |
| 147 | "enums": {n: e.to_dict() for n, e in self.enums.items()}, |
| 148 | "structs": {n: s.to_dict() for n, s in self.structs.items()}, |
| 149 | "defines": { |
| 150 | n: {"value": d.value, "doc": d.doc, "file": d.file, "line": d.line} |
| 151 | for n, d in self.defines.items() |
| 152 | }, |
| 153 | "hand_enums": {n: e.to_dict() for n, e in self.hand_enums.items()}, |
| 154 | } |