def make_symbol()

in cbmc_viewer/symbolt.py [0:0]


def make_symbol(viewer_symbol, viewer_source, goto, wkdir, srcdir, files):
    """Implementation of make-symbol."""

    wkdir = srcloct.abspath(wkdir) if wkdir else None
    srcdir = srcloct.abspath(srcdir) if srcdir else None

    # Command line options may enable more than one way
    # to generate the symbol table, so choose the one
    # that gives the most "accurate" results.

    if viewer_symbol:
        logging.info("Symbols by SymbolFromJson")
        return SymbolFromJson(viewer_symbol)

    if viewer_source:
        sources = sourcet.SourceFromJson(viewer_source)
        srcdir = sources.root
        files = sources.files

    if srcdir and files:
        SymbolFromCtags(srcdir, files)

    if goto and wkdir and srcdir:
        logging.info("Symbols by SymbolFromGoto")
        return SymbolFromGoto(goto, wkdir, srcdir)

    logging.info("make-symbol: nothing to do: need "
                 "--goto and --wkdir and --srcdir or "
                 "--viewer-source or"
                 "--viewer-symbol")
    return Symbol()