Skip to content

Commit

Permalink
Add 'cpp' segment
Browse files Browse the repository at this point in the history
  • Loading branch information
mkst committed Aug 16, 2023
1 parent 6ec2b39 commit bcb24f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion segtypes/common/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class CommonSegC(CommonSegCodeSubsegment):
global_asm_funcs: Set[str] = set()
global_asm_rodata_syms: Set[str] = set()

file_extension = "c"

STRIP_C_COMMENTS_RE = re.compile(
r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
re.DOTALL | re.MULTILINE,
Expand Down Expand Up @@ -124,7 +126,7 @@ def is_text() -> bool:
return True

def out_path(self) -> Optional[Path]:
return options.opts.src_path / self.dir / f"{self.name}.c"
return options.opts.src_path / self.dir / f"{self.name}.{self.file_extension}"

def scan(self, rom_bytes: bytes):
if (
Expand Down
5 changes: 5 additions & 0 deletions segtypes/common/cpp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from segtypes.common.c import CommonSegC


class CommonSegCpp(CommonSegC):
file_extension = "cpp"

0 comments on commit bcb24f6

Please sign in to comment.