| 598 | |
| 599 | def _parse_blutter_asm(asm_dir: Path) -> Tuple[List[dict], List[dict], List[dict]]: |
| 600 | if not asm_dir.exists() or not asm_dir.is_dir(): |
| 601 | raise BackendFailed(f"blutter asm directory not found: {asm_dir}") |
| 602 | |
| 603 | header_re = re.compile(r"^//\s*lib:\s*.*?,\s*url:\s*(\S+)\s*$") |
| 604 | addr_re = re.compile(r"//\s*\*\*\s*addr:\s*(0x[0-9a-fA-F]+),\s*size:\s*(0x[0-9a-fA-F]+)") |
| 605 | |
| 606 | library_ids: Dict[str, int] = {} |
| 607 | class_ids: Dict[Tuple[Optional[int], str], int] = {} |
| 608 | class_supers: Dict[int, str] = {} |
| 609 | class_names: Dict[str, int] = {} |
| 610 | functions: List[dict] = [] |
| 611 | seen_entry: Set[int] = set() |
| 612 | |
| 613 | def ensure_library(uri: str) -> Optional[int]: |
| 614 | normalized = _normalize_library_uri(uri) |
| 615 | if normalized is None: |
| 616 | return None |
| 617 | if normalized not in library_ids: |
| 618 | library_ids[normalized] = len(library_ids) |
| 619 | return library_ids[normalized] |
| 620 | |
| 621 | def ensure_class(library: Optional[int], name: str, super_name: Optional[str]) -> int: |