How to use the pcpp.pcmd.CmdPreprocessor function in pcpp

To help you get started, we’ve selected a few pcpp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ned14 / pcpp / pcpp / pcmd.py View on Github external
def main():
    p = CmdPreprocessor(sys.argv)
    sys.exit(p.return_code)
github ned14 / pcpp / pcpp / pcmd.py View on Github external
def on_potential_include_guard(self,macro):
        self.potential_include_guard = macro
        return super(CmdPreprocessor, self).on_potential_include_guard(macro)

    def on_comment(self,tok):
        if self.args.passthru_comments:
            return True  # Pass through
        return super(CmdPreprocessor, self).on_comment(tok)

def main():
    p = CmdPreprocessor(sys.argv)
    sys.exit(p.return_code)
        
if __name__ == "__main__":
    p = CmdPreprocessor(sys.argv)
    sys.exit(p.return_code)
github ned14 / pcpp / pcpp / pcmd.py View on Github external
def on_unknown_macro_in_defined_expr(self,tok):
        if self.args.undefines:
            if tok.value in self.args.undefines:
                return False
        if self.args.passthru_undefined_exprs:
            return None  # Pass through as expanded as possible
        return super(CmdPreprocessor, self).on_unknown_macro_in_defined_expr(tok)
github ned14 / stl-header-heft / profile-stl.py View on Github external
def process_header(stl, header_path, flags, header):
    try:
        cmdline = [
            'noexec',
            '-o', os.path.join(stl, header + '.all.hpp'),
            header_path % header,
            '--filetimes=' + os.path.join(stl, header) + '.csv',
            '-D', '__cplusplus=20300000',
            '-D', '__cpp_lib_concepts=1'
        ] + flags
        p = CmdPreprocessor(cmdline)
        print("%s took %f secs" % (header, p.include_times[0].elapsed))
        return (p.include_times[0].elapsed, header)
    except:
        print('%s: %s' % (header, traceback.format_exc()))
        return (-1, header)