Lines Matching +full:sub +full:- +full:group

8 Usage: block-coroutine-wrapper.py generated-file.c FILE.[ch]...
32 copyright = re.sub('^.*Copyright', 'Copyright', __doc__, flags=re.DOTALL)
33 copyright = re.sub('^(?=.)', ' * ', copyright.strip(), flags=re.MULTILINE)
34 copyright = re.sub('^$', ' *', copyright, flags=re.MULTILINE)
37 * File is generated by scripts/block-coroutine-wrapper.py
44 #include "block/block-gen.h"
46 #include "block/dirty-bitmap.h"
53 r'(?P<name>[a-z][a-z0-9_]*)'
56 def __init__(self, param_decl: str) -> None:
60 self.decl = m.group('decl')
61 self.type = m.group('type')
62 self.name = m.group('name')
67 args: str, variant: str) -> None:
95 self.get_result = 's->ret = '
105 def gen_ctx(self, prefix: str = '') -> str:
111 return f'bdrv_get_aio_context({prefix}{name}->bs)'
117 def gen_list(self, format: str) -> str:
120 def gen_block(self, format: str) -> str:
125 func_decl_re = re.compile(r'^(?P<return_type>[a-zA-Z][a-zA-Z0-9_]* [\*]?)'
128 r'(?P<variant>(_[a-z][a-z0-9_]*)?)\s*'
129 r'(?P<wrapper_name>[a-z][a-z0-9_]*)'
133 def func_decl_iter(text: str) -> Iterator:
135 yield FuncDecl(wrapper_type=m.group('wrapper_type'),
136 return_type=m.group('return_type'),
137 name=m.group('wrapper_name'),
138 args=m.group('args'),
139 variant=m.group('variant'))
142 def snake_to_camel(func_name: str) -> str:
144 Convert underscore names like 'some_function_name' to camel-case like
152 def create_mixed_wrapper(func: FuncDecl) -> str:
182 def create_co_wrapper(func: FuncDecl) -> str:
206 def gen_co_wrapper(func: FuncDecl) -> str:
239 {func.get_result}{name}({ func.gen_list('s->{name}') });
241 s->poll_state.in_progress = false;
249 def gen_no_co_wrapper(func: FuncDecl) -> str:
281 {func.get_result}{name}({ func.gen_list('s->{name}') });
284 aio_co_wake(s->co);
302 def gen_wrappers(input_code: str) -> str:
318 with open(sys.argv[1], 'w', encoding='utf-8') as f_out:
321 with open(fname, encoding='utf-8') as f_in: