Mercurial > hg > CbC > old > CbC_scripts
changeset 17:77c1716f7aff
fix meta connection at no arg code segments
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 26 Oct 2015 17:09:11 +0900 |
parents | f748d295b08f |
children | 787278249896 |
files | meta_connector/meta_connector.py |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/meta_connector/meta_connector.py Thu Oct 22 17:15:06 2015 +0900 +++ b/meta_connector/meta_connector.py Mon Oct 26 17:09:11 2015 +0900 @@ -4,6 +4,7 @@ import sys import argparse import re +import textwrap # parse arguments and return arguments list. def get_args(): @@ -44,16 +45,17 @@ # get caller code segment name if re.search(r"^ *__code",l) is not None: + isMetaOrStub = False caller_name = regexed_l.group(0).rstrip('(') - if re.search(r"^ *meta_*|stub$",caller_name) is not None: + if re.search(r"^ *meta_*|stub$",caller_name) is not None: # meta code segment or stub isMetaOrStub = True file.write(l) - else: - isMetaOrStub = False - splited = l.split('(',1) + elif re.search(r"struct Context\* context",l) is None: + args = l.split('(')[1].rsplit(')')[0].strip() + args = ', ' + args if args else '' file.write("/*-- generated by script */\n") file.write('// '+l) - file.write('{0:s}(struct Context* context, {1:s}'.format(splited[0],splited[1])) + file.write('__code {0:s}(struct Context* context{1:s}) {{\n'.format(caller_name,args)) elif not isMetaOrStub and regexed_l is not None and re.search(r"^ *goto",l): callee_name = regexed_l.group(0).rstrip('(') if callee_name == 'start_code' or re.match('meta_|meta$',callee_name):