コード例 #1
0
ファイル: reader.py プロジェクト: lihebi/PyHelium
def remove_instrument(doc):
    pre_node = annotation.get_comment_node_by_annotation(doc, '@Pre')
    post_node = annotation.get_comment_node_by_annotation(doc, '@Post')
    inner_node = annotation.get_comment_node_by_annotation(doc, '@Inner')
    if pre_node: pre_node.parentNode.removeChild(pre_node)
    if post_node: post_node.parentNode.removeChild(post_node)
    if inner_node: inner_node.parentNode.removeChild(inner_node)
コード例 #2
0
ファイル: instrumenter.py プロジェクト: lihebi/PyHelium
 def do_instrument(self, annotate, instrument_type=''):
     output_code = ''
     if not instrument_type:
         instrument_type = config.get('instrument_type')
     instrument_node = annotation.get_comment_node_by_annotation(self.doc, annotate)
     if instrument_node:
         if instrument_type == 'variable':
             alive_vars = io.resolve_alive_vars(instrument_node, set())
             for var_name in alive_vars:
                 type_name = alive_vars[var_name]
                 self.struct_limit = 30
                 output_code += self.generate_output(type_name, var_name)
         elif instrument_type == 'count':
             output_code = 'printf("%d ", 5678);\n'
     # so that it can print out something(such as precondition) even if the program crash
     output_code += 'printf("\\n");'
     self.code = self.code.replace('//'+annotate, output_code, 1)