Mercurial > hg > CbC > old > CbC_scripts
changeset 20:e06b47585c4f support meta connection and default meta code segment generation
generate default meta code segment
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 26 Oct 2015 21:14:31 +0900 |
parents | e11ec04d2cd8 |
children | 6ec2d00b0957 |
files | meta_connector/meta_connector.py |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/meta_connector/meta_connector.py Mon Oct 26 17:30:00 2015 +0900 +++ b/meta_connector/meta_connector.py Mon Oct 26 21:14:31 2015 +0900 @@ -35,9 +35,9 @@ # parse input file and create meta connection list def parse_meta_syntax(lines,file): comment_out = False - target_cs = False caller_name = '' isMetaOrStub = False + defaultMetaIsNotExist = True for i,l in enumerate(lines): regexed_l = re.search(r"[a-zA-Z0-9_]+ *\(",l) @@ -46,6 +46,8 @@ if re.search(r"^ *__code",l) is not None: isMetaOrStub = False caller_name = regexed_l.group(0).rstrip('(') + if caller_name == 'meta': + defaultMetaIsNotExist = False if re.search(r"^ *meta_*|stub$",caller_name) is not None: # meta code segment or stub isMetaOrStub = True file.write(l) @@ -65,6 +67,15 @@ callee_name.capitalize())) else: file.write(l) + if defaultMetaIsNotExist: + create_default_metacs(file) + +def create_default_metacs(file): + file.write(''' +__code meta(struct Context* context, enum Code next) { + goto (context->code[next])(context); +} + ''') def get_args_from_line(line): args = line.split('(')[1].rsplit(')')[0].strip()