Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions chb/app/CHVersion.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
chbversion: str = "0.3.0-20260324"
chbversion: str = "0.3.0-20260329"

minimum_required_chb_version = "0.6.0_20260324"
minimum_required_chb_version = "0.6.0_20260329"
6 changes: 3 additions & 3 deletions chb/arm/ARMCallOpcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2022-2025 Aarno Labs LLC
# Copyright (c) 2022-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -173,8 +173,8 @@ def calltarget(self) -> "CallTarget":
def annotation(self) -> str:
tgt = str(self.calltarget)
args = ", ".join(str(x) for x in self.arguments)
cargs = " (C: (" + ", ".join(str(x) for x in self.c_arguments) + "))"
call = "call " + str(tgt) + "(" + args + ")" + cargs
# cargs = " (C: (" + ", ".join(str(x) for x in self.c_arguments) + "))"
call = "call " + str(tgt) + "(" + args + ")" # + cargs
return self.add_instruction_condition(call)


Expand Down
12 changes: 11 additions & 1 deletion chb/bctypes/BCAttrParam.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2022 Aarno Labs LLC
# Copyright (c) 2022-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -60,6 +60,7 @@
from chb.bctypes.BCDictionary import BCDictionary
from chb.bctypes.BCTyp import BCTyp
from chb.bctypes.BCTypSig import BCTypSig
from chb.bctypes.BCVisitor import BCVisitor


class BCAttrParam(BCDictionaryRecord):
Expand Down Expand Up @@ -104,6 +105,9 @@ def is_int(self) -> bool:
def to_c_string(self) -> str:
return str(self.intvalue)

def accept(self, visitor: "BCVisitor") -> None:
visitor.visit_attr_param_int(self)

def __str__(self) -> str:
return "aint(" + str(self.intvalue) + ")"

Expand All @@ -126,6 +130,9 @@ def strvalue(self) -> str:
def to_c_string(self) -> str:
return self.strvalue

def accept(self, visitor: "BCVisitor") -> None:
visitor.visit_attr_param_str(self)

def __str__(self) -> str:
return "astr(" + self.strvalue + ")"

Expand Down Expand Up @@ -158,6 +165,9 @@ def to_c_string(self) -> str:
+ ", ".join(p.to_c_string for p in self.params)
+ ")")

def accept(self, visitor: "BCVisitor") -> None:
visitor.visit_attr_param_cons(self)

def __str__(self) -> str:
return (
"acons("
Expand Down
9 changes: 8 additions & 1 deletion chb/bctypes/BCAttribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2022-2023 Aarno Labs LLC
# Copyright (c) 2022-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -35,6 +35,7 @@
if TYPE_CHECKING:
from chb.bctypes.BCDictionary import BCDictionary
from chb.bctypes.BCAttrParam import BCAttrParam
from chb.bctypes.BCVisitor import BCVisitor


class BCAttribute(BCDictionaryRecord):
Expand All @@ -61,6 +62,9 @@ def is_volatile(self) -> bool:
def to_c_string(self) -> str:
return self.name + "(" + ", ".join(p.to_c_string for p in self.params) + ")"

def accept(self, visitor: "BCVisitor") -> None:
visitor.visit_attribute(self)

def __str__(self) -> str:
return self.name + "(" + ", ".join(str(p) for p in self.params) + ")"

Expand All @@ -81,6 +85,9 @@ def attrs(self) -> List[BCAttribute]:
def is_empty(self) -> bool:
return len(self.attrs) == 0

def accept(self, visitor: "BCVisitor") -> None:
visitor.visit_attributes(self)

@property
def to_c_string(self) -> str:
return (
Expand Down
10 changes: 7 additions & 3 deletions chb/bctypes/BCCompInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2021-2023 Aarno Labs LLC
# Copyright (c) 2021-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -29,16 +29,17 @@

import chb.ast.ASTNode as AST

from chb.bctypes.BCConverter import BCConverter
from chb.bctypes.BCDictionaryRecord import BCDictionaryRecord

import chb.util.fileutil as UF
import chb.util.IndexedTable as IT

if TYPE_CHECKING:
from chb.bctypes.BCConverter import BCConverter
from chb.bctypes.BCDictionary import BCDictionary
from chb.bctypes.BCFieldInfo import BCFieldInfo
from chb.bctypes.BCTyp import BCTyp
from chb.bctypes.BCVisitor import BCVisitor


class OffsetAccumulator:
Expand Down Expand Up @@ -209,7 +210,10 @@ def field_at_offset(self, offset: int) -> Tuple["BCFieldInfo", int]:
+ str(self.alignment())
+ ")")

def convert(self, converter: BCConverter) -> AST.ASTCompInfo:
def accept(self, visitor: "BCVisitor") -> None:
visitor.visit_compinfo(self)

def convert(self, converter: "BCConverter") -> AST.ASTCompInfo:
return converter.convert_compinfo(self)

def __str__(self) -> str:
Expand Down
13 changes: 12 additions & 1 deletion chb/bctypes/BCDictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2021-2024 Aarno Labs LLC
# Copyright (c) 2021-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -263,6 +263,17 @@ def initialize(self, xnode: Optional[ET.Element]) -> None:
cinfo = self.compinfo(ix)
self.compinfo_keys[cinfo.ckey] = cinfo

# ------------------ Values ------------------------------------------------

def typeinfos(self) -> List["BCTypeInfo"]:
return [self.typeinfo(ix) for ix in self.typeinfo_table.keys()]

def varinfos(self) -> List["BCVarInfo"]:
return [self.varinfo(ix) for ix in self.varinfo_table.keys()]

def compinfos(self) -> List["BCCompInfo"]:
return [self.compinfo(ix) for ix in self.compinfo_table.keys()]

# ------------------ Printing ----------------------------------------------

def typ_table_to_string(self) -> str:
Expand Down
10 changes: 7 additions & 3 deletions chb/bctypes/BCEnumInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2022 Aarno Labs LLC
# Copyright (c) 2022-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -29,16 +29,17 @@

import chb.ast.ASTNode as AST

from chb.bctypes.BCConverter import BCConverter
from chb.bctypes.BCDictionaryRecord import BCDictionaryRecord

import chb.util.fileutil as UF
import chb.util.IndexedTable as IT

if TYPE_CHECKING:
from chb.bctypes.BCConverter import BCConverter
from chb.bctypes.BCDictionary import BCDictionary
from chb.bctypes.BCEnumItem import BCEnumItem
from chb.bctypes.BCTyp import BCTyp
from chb.bctypes.BCVisitor import BCVisitor


class BCEnumInfo(BCDictionaryRecord):
Expand All @@ -61,7 +62,10 @@ def ekind(self) -> str:
def enumitems(self) -> List["BCEnumItem"]:
return [self.bcd.enumitem(i) for i in self.args[1:]]

def convert(self, converter: BCConverter) -> AST.ASTEnumInfo:
def accept(self, visitor: "BCVisitor") -> None:
visitor.visit_enuminfo(self)

def convert(self, converter: "BCConverter") -> AST.ASTEnumInfo:
return converter.convert_enuminfo(self)

def __str__(self) -> str:
Expand Down
12 changes: 8 additions & 4 deletions chb/bctypes/BCEnumItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2022 Aarno Labs LLC
# Copyright (c) 2022-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -29,16 +29,17 @@

import chb.ast.ASTNode as AST

from chb.bctypes.BCConverter import BCConverter
from chb.bctypes.BCDictionaryRecord import BCDictionaryRecord

import chb.util.fileutil as UF
import chb.util.IndexedTable as IT

if TYPE_CHECKING:
from chb.bctypes.BCConverter import BCConverter
from chb.bctypes.BCDictionary import BCDictionary
from chb.bctypes.BCTyp import BCTyp, BCTypArray, BCTypComp
from chb.bctypes.BCExp import BCExp
from chb.bctypes.BCTyp import BCTyp, BCTypArray, BCTypComp
from chb.bctypes.BCVisitor import BCVisitor


class BCEnumItem(BCDictionaryRecord):
Expand All @@ -57,7 +58,10 @@ def itemname(self) -> str:
def itemexpr(self) -> "BCExp":
return self.bcd.exp(self.args[0])

def convert(self, converter: BCConverter) -> AST.ASTEnumItem:
def accept(self, visitor: "BCVisitor") -> None:
return visitor.visit_enumitem(self)

def convert(self, converter: "BCConverter") -> AST.ASTEnumItem:
return converter.convert_enumitem(self)

def __str__(self) -> str:
Expand Down
10 changes: 7 additions & 3 deletions chb/bctypes/BCFieldInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2021-2023 Aarno Labs LLC
# Copyright (c) 2021-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -29,7 +29,6 @@

import chb.ast.ASTNode as AST

from chb.bctypes.BCConverter import BCConverter
from chb.bctypes.BCDictionaryRecord import BCDictionaryRecord

import chb.util.fileutil as UF
Expand All @@ -38,8 +37,10 @@
if TYPE_CHECKING:
from chb.bctypes.BCAttribute import BCAttribute
from chb.bctypes.BCAttrParam import BCAttrParam, BCAttrParamInt
from chb.bctypes.BCConverter import BCConverter
from chb.bctypes.BCDictionary import BCDictionary
from chb.bctypes.BCTyp import BCTyp, BCTypArray, BCTypComp
from chb.bctypes.BCVisitor import BCVisitor


class BCFieldInfo(BCDictionaryRecord):
Expand Down Expand Up @@ -90,7 +91,10 @@ def alignment(self) -> int:

return self.fieldtype.alignment()

def convert(self, converter: BCConverter) -> AST.ASTFieldInfo:
def accept(self, visitor: "BCVisitor") -> None:
visitor.visit_fieldinfo(self)

def convert(self, converter: "BCConverter") -> AST.ASTFieldInfo:
return converter.convert_fieldinfo(self)

def __str__(self) -> str:
Expand Down
7 changes: 6 additions & 1 deletion chb/bctypes/BCFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2021-2024 Aarno Labs LLC
# Copyright (c) 2021-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -49,6 +49,7 @@ class BCFiles:

def __init__(self, app: "AppAccess", xnode: ET.Element) -> None:
self._app = app
self._typeinfos: List[BCTypeInfo] = []
self._gtypes: List[BCTyp] = []
self._gcomptags: List[BCCompInfo] = []
self._genumtags: List[BCEnumInfo] = []
Expand All @@ -66,6 +67,10 @@ def app(self) -> "AppAccess":
def bcd(self) -> BCDictionary:
return self.app.bcdictionary

@property
def typeinfos(self) -> List[BCTypeInfo]:
return self._typeinfos

@property
def gtypes(self) -> List[BCTyp]:
return self._gtypes
Expand Down
8 changes: 7 additions & 1 deletion chb/bctypes/BCFunArgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2021-2022 Aarno Labs LLC
# Copyright (c) 2021-2026 Aarno Labs LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -60,6 +60,9 @@ def typ(self) -> "BCTyp":
def is_leq(self, other: "BCFunArg") -> bool:
return self.typ.is_leq(other.typ)

def accept(self, visitor: "BCVisitor") -> None:
visitor.visit_funarg(self)

def convert(self, converter: "BCConverter") -> AST.ASTFunArg:
return converter.convert_funarg(self)

Expand Down Expand Up @@ -115,6 +118,9 @@ def is_scalar_argtypes(self) -> bool:
def is_leq(self, other: "BCFunArgs") -> bool:
return all(a.is_leq(o) for (a, o) in zip(self.funargs, other.funargs))

def accept(self, visitor: "BCVisitor") -> None:
visitor.visit_funargs(self)

def convert(self, converter: "BCConverter") -> AST.ASTFunArgs:
return converter.convert_funargs(self)

Expand Down
Loading