chc.app.CGlobalDeclarations module
Declarations of global entities across files.
- class chc.app.CGlobalDeclarations.CGlobalDeclarations(capp: CApplication, xnode: Optional[xml.etree.ElementTree.Element])[source]
Bases:
chc.app.CDeclarations.CDeclarationsDictionary that indexes global vars and struct definitions from all files.
The indexing of struct definitions may involve backtracking in the case of structs that contain pointer references to itself, or circular references that involve multiple structs.
The backtracking is performed per file. When a struct (represented by a compinfo) is indexed its status is set to pending. When a request for a TComp ckey conversion for the same compinfo is encountered a new global key is conjectured as follows:
gckey that has already been reserved for this ckey
gckey that has already been conjectured for this ckey
gckey for an existing global compinfo that has the same fields, if (ckey,gckey) is not in the list of incompatibles
reserve a new key from the indexed table and set its status to reserved, and remove its pending status
When the compinfo for ckey has been constructed the state is updated as follows:
if ckey had a reserved key the reserved key is now committed
if ckey had a conjectured key and the conjectured key is the same as the returned gckey, nothing needs to be done
if ckey had a conjectured key but the conjectured key is not the same as the returned gckey, add (ckey,gckey) to the list of incompatibles, reset the indexed table to the file checkpoint, and re-index all compinfos in the file.
- property capp: CApplication
- property cfile: CFile
- property ckey2gckey: Dict[int, Dict[int, int]]
Returns the global compinfo key for a given file and compinfo key
fid -> ckey -> gckey
- conjecture_key(fid: int, compinfo: chc.app.CCompInfo.CCompInfo) int[source]
- convert_ckey(ckeyref: chc.app.IndexManager.CKeyReference) Optional[int][source]
- property dictionary: chc.app.CGlobalDictionary.CGlobalDictionary
- property fieldstrings: Dict[str, List[int]]
Returns a map from a conjoined fieldstring to global struct keys
fieldstrings -> gckey
- get_compinfo(ix: int) chc.app.CCompInfo.CCompInfo[source]
- get_compinfo_by_ckey(ckey: int) chc.app.CCompInfo.CCompInfo[source]
- get_fieldinfo(ix: int) chc.app.CFieldInfo.CFieldInfo[source]
- get_gckey(ckeyref: chc.app.IndexManager.CKeyReference) Optional[int][source]
- get_gcompinfo(ckeyref: chc.app.IndexManager.CKeyReference) Optional[chc.app.CCompInfo.CCompInfo][source]
Returns the global compinfo associated with a file compinfo.
- get_gvid(varref: chc.app.IndexManager.VarReference) Optional[int][source]
- get_initinfo(ix: int) chc.app.CInitInfo.CInitInfo[source]
- get_offset_init(ix: int) chc.app.CInitInfo.COffsetInitInfo[source]
- get_opaque_struct() chc.app.CCompInfo.CCompInfo[source]
- get_varinfo(ix: int) chc.app.CVarInfo.CVarInfo[source]
- get_varinfo_by_name(name: str) chc.app.CVarInfo.CVarInfo[source]
- property globalcontract: CGlobalContract
- index_compinfo_key(compinfo: chc.app.CCompInfo.CCompInfo, fid: int) int[source]
Returns the global ckey for the given compinfo and file id.
- index_fieldinfo(fieldinfo: chc.app.CFieldInfo.CFieldInfo, compinfoname: str) int[source]
- index_file_compinfos(fid: int, compinfos: List[chc.app.CCompInfo.CCompInfo]) None[source]
Indexes and connects the compinfos from the individual c files.
- index_file_varinfos(fid: int, varinfos: List[chc.app.CVarInfo.CVarInfo]) None[source]
- index_init(init: chc.app.CInitInfo.CInitInfo, fid: int = - 1) int[source]
- index_offset_init(oinit: chc.app.CInitInfo.COffsetInitInfo, fid: int = - 1) int[source]
- index_varinfo_vid(varref: chc.app.IndexManager.VarReference) Optional[int][source]
- make_global_compinfo(fid: int, compinfo: chc.app.CCompInfo.CCompInfo) chc.app.CCompInfo.CCompInfo[source]
- make_global_varinfo(fid: int, varinfo: chc.app.CVarInfo.CVarInfo) None[source]
Returns the global varinfo that corresponds to a file varinfo.
- register_gcompinfo(ckeyref: chc.app.IndexManager.CKeyReference, gcompinfo: chc.app.CCompInfo.CCompInfo) None[source]
- show_compinfos(name: str) List[Tuple[int, chc.app.CCompInfo.CCompInfo]][source]
- property varinfo_storage_classes: Dict[int, Set[str]]
- varinfo_values() List[chc.app.CVarInfo.CVarInfo][source]
- property vid2gvid: Dict[int, Dict[int, int]]
Returns the global vid for a given file and varinfo vid.
fid -> vid -> gvid.