chc.app.IndexManager module

Global variable and struct definition relationships between files.

class chc.app.IndexManager.CKeyReference(fid: Optional[int], ckey: int)[source]

Bases: object

ckey: int
fid: Optional[int]
property is_global: bool
class chc.app.IndexManager.FileKeyReference(fid: int, ckey: int)[source]

Bases: object

ckey: int
fid: int
class chc.app.IndexManager.FileVarReference(fid: int, vid: int)[source]

Bases: object

fid: int
property tuple: Tuple[int, int]
vid: int
class chc.app.IndexManager.IndexManager(issinglefile: bool)[source]

Bases: object

add_ckey2gckey(filekey: chc.app.IndexManager.FileKeyReference, gckey: int) None[source]

Registers a local file ckey with a global ckey.

add_file(cfile: CFile) None[source]
add_vid2gvid(filevar: chc.app.IndexManager.FileVarReference, gvid: int) None[source]

Registers a local file vid with a global vid.

convert_ckey(filekey: chc.app.IndexManager.FileKeyReference, tgtfid: int) Optional[int][source]

Returns the ckey of filekey of the same struct in the file tgtfid.

convert_vid(varref: chc.app.IndexManager.FileVarReference, tgtfid: int) Optional[int][source]

Returns the vid of the var reference in (another) file tgtfid.

get_fid_gvid_subset(fileindex: int) Dict[int, int][source]
get_gckey(filekey: chc.app.IndexManager.FileKeyReference) Optional[int][source]

Returns the global ckey index for a file ckey reference.

get_gvid(varref: chc.app.IndexManager.FileVarReference) Optional[int][source]

Returns the global vid that corresponds to the file var reference.

get_gvid_reference(gvid: int, fid: int) Optional[int][source]

Returns the vid that corresponds to gvid in the file with index fid.

get_gvid_references(gvid: int) List[chc.app.IndexManager.FileVarReference][source]

Returns a list all file variables that refer to the same global var.

get_vid(fid: int, gvid: int) Optional[int][source]

Returns the vid of the gvid in the file with index fid.

get_vid_gvid_subst(fid: int) Dict[int, int][source]
get_vid_references(filevar: chc.app.IndexManager.FileVarReference) List[chc.app.IndexManager.FileVarReference][source]

Returns a list of file vars that refer to the same variable as filevar.

Note: does not include filevar itself.

has_gvid_reference(gvid: int, fid: int) bool[source]
property is_single_file: bool
resolve_vid(filevar: chc.app.IndexManager.FileVarReference) Optional[chc.app.IndexManager.FileVarReference][source]

Returns the local reference of the definition of (fid, vid).

An object (variable or function) may be declared in one file (fid) and referenced by vid, but defined in another file, with file index def-fid and variable reference def-vid. If the definition is found this method returns (def-fid, def-vid).

save_xrefs(targetpath: str, projectname: str, cfilepath: Optional[str], cfilename: str, fid: int) None[source]
class chc.app.IndexManager.VarReference(fid: Optional[int], vid: int)[source]

Bases: object

fid: Optional[int]
property is_global: bool
vid: int
chc.app.IndexManager.fidvidmax_initial_value = 1000000

TODO: - save gxrefs file if new vid’s were added to a file