def dispatch_wp(process_fn, wp): results = [] try: if not wp.cfg.enabled: wp.mh.register_exclusion(wp.filename) results.append(work_package.Result(wp, False)) elif isinstance(wp, work_package.SIMULINK_File_WP): wp.register_file() slp = s_parser.Simulink_SLX_Parser(wp.mh, wp.filename, wp.cfg) n_content = slp.parse_file() if n_content: for block in n_content.iter_all_blocks(): if isinstance(block, s_ast.Matlab_Function): block_wp = work_package.Embedded_MATLAB_WP(wp, block) block_wp.register_file() results.append(process_fn(block_wp)) if wp.modified: slp.save_and_close() elif isinstance(wp, work_package.MATLAB_File_WP): wp.register_file() results.append(process_fn(wp)) else: raise errors.ICE("unknown work package kind %s" % wp.__class__.__name__) except errors.Error: raise errors.ICE("uncaught Error in process_wp") return results
def process_wp(cls, wp): raise errors.ICE("unimplemented process_wp function")