Matthew Barth | 702c4a5 | 2018-02-28 16:23:11 -0600 | [diff] [blame] | 1 | <%! |
| 2 | def indent(str, depth): |
| 3 | return ''.join(4*' '*depth+line for line in str.splitlines(True)) |
| 4 | %>\ |
| 5 | |
| 6 | <%def name="genHandler(sig)" buffered="True"> |
| 7 | %if ('type' in sig['sparams']) and \ |
| 8 | (sig['sparams']['type'] is not None): |
| 9 | ${sig['signal']}<${sig['sparams']['type']}>( |
| 10 | %else: |
| 11 | ${sig['signal']}( |
| 12 | %endif |
| 13 | %for spk in sig['sparams']['params']: |
| 14 | ${sig['sparams'][spk]}, |
| 15 | %endfor |
| 16 | %if ('type' in sig['hparams']) and \ |
| 17 | (sig['hparams']['type'] is not None): |
| 18 | handler::${sig['handler']}<${sig['hparams']['type']}>( |
| 19 | %else: |
| 20 | handler::${sig['handler']}( |
| 21 | %endif |
| 22 | %for i, hpk in enumerate(sig['hparams']['params']): |
| 23 | %if (i+1) != len(sig['hparams']['params']): |
| 24 | ${sig['hparams'][hpk]}, |
| 25 | %else: |
| 26 | ${sig['hparams'][hpk]} |
| 27 | %endif |
| 28 | %endfor |
| 29 | )) |
| 30 | </%def>\ |
| 31 | |
| 32 | <%def name="genSSE(event)" buffered="True"> |
| 33 | Group{ |
| 34 | %for group in event['groups']: |
| 35 | %for member in group['members']: |
| 36 | { |
| 37 | "${member['object']}", |
| 38 | {"${member['interface']}", |
| 39 | "${member['property']}"} |
| 40 | }, |
| 41 | %endfor |
| 42 | %endfor |
| 43 | }, |
| 44 | std::vector<Action>{ |
| 45 | %for a in event['action']: |
| 46 | %if len(a['parameters']) != 0: |
| 47 | make_action(action::${a['name']}( |
| 48 | %else: |
| 49 | make_action(action::${a['name']} |
| 50 | %endif |
| 51 | %for i, p in enumerate(a['parameters']): |
| 52 | %if (i+1) != len(a['parameters']): |
| 53 | ${p}, |
| 54 | %else: |
| 55 | ${p}) |
| 56 | %endif |
| 57 | %endfor |
| 58 | ), |
| 59 | %endfor |
| 60 | }, |
William A. Kennington III | 122b843 | 2018-10-30 18:39:21 -0700 | [diff] [blame] | 61 | TimerConf{ |
Matthew Barth | 702c4a5 | 2018-02-28 16:23:11 -0600 | [diff] [blame] | 62 | ${event['timer']['interval']}, |
| 63 | ${event['timer']['type']} |
| 64 | }, |
| 65 | std::vector<Signal>{ |
| 66 | %for s in event['signals']: |
| 67 | Signal{ |
Matthew Barth | 18c9103 | 2019-01-29 15:36:00 -0600 | [diff] [blame^] | 68 | %if ('match' in s) and \ |
| 69 | (s['match'] is not None): |
Matthew Barth | 702c4a5 | 2018-02-28 16:23:11 -0600 | [diff] [blame] | 70 | match::${s['match']}( |
| 71 | %for i, mp in enumerate(s['mparams']): |
| 72 | %if (i+1) != len(s['mparams']): |
| 73 | "${mp}", |
| 74 | %else: |
| 75 | "${mp}" |
| 76 | %endif |
| 77 | %endfor |
| 78 | ), |
Matthew Barth | 18c9103 | 2019-01-29 15:36:00 -0600 | [diff] [blame^] | 79 | %else: |
| 80 | "", |
| 81 | %endif |
Matthew Barth | 702c4a5 | 2018-02-28 16:23:11 -0600 | [diff] [blame] | 82 | make_handler(\ |
| 83 | ${indent(genHandler(sig=s), 3)}\ |
| 84 | ) |
| 85 | }, |
| 86 | %endfor |
| 87 | } |
| 88 | </%def>\ |