Mercurial > hg > CbC > old > CbC_scripts
changeset 19:e11ec04d2cd8
minor fix
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 26 Oct 2015 17:30:00 +0900 |
parents | 787278249896 |
children | e06b47585c4f |
files | meta_connector/meta_connector.py |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/meta_connector/meta_connector.py Mon Oct 26 17:21:08 2015 +0900 +++ b/meta_connector/meta_connector.py Mon Oct 26 17:30:00 2015 +0900 @@ -4,7 +4,6 @@ import sys import argparse import re -import textwrap # parse arguments and return arguments list. def get_args(): @@ -51,11 +50,9 @@ isMetaOrStub = True file.write(l) 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('__code {0:s}(struct Context* context{1:s}) {{\n'.format(caller_name,args)) + file.write('__code {0:s}(struct Context* context{1:s}) {{\n'.format(caller_name,get_args_from_line(l))) 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): @@ -63,14 +60,18 @@ else: file.write("/*-- connected by script */\n") file.write('// '+l) - args = l.split('(')[1].rsplit(')')[0].strip() - args = ', ' + args if args else '' meta_name = 'meta_'+caller_name if meta_search(lines, callee_name) else 'meta' - file.write("goto {0:s}(context{1:s} ,{2:s});\n".format(meta_name, args,\ + file.write("goto {0:s}(context{1:s}, {2:s});\n".format(meta_name, get_args_from_line(l),\ callee_name.capitalize())) else: file.write(l) +def get_args_from_line(line): + args = line.split('(')[1].rsplit(')')[0].strip() + args = ', ' + args if args else '' + return args + + # search meta code segment. # Find it : __code meta_'name' def meta_search(lines, name):