def control_flow_from(self, src, type=CONTROL_OP, version=None): ''' Add control flow edge of the given type from src to self. If version is specified, then add flow to dest with explicit version, else add to most recent version. Allowed types: CPL.CONTROL_OP (default) CPL.CONTROL_START CPL.CONTROL_GENERIC is an alias for CPL.CONTROL_OP. ''' if isinstance(src, cpl_object_version): if version is not None and version != VERSION_NONE: raise Exception('The version argument must be None if ' + 'src is of type cpl_object_version') _version = src.version _src = src.object elif version is None or version == VERSION_NONE: _version = src.version() _src = src else: _version = version _src = src ret = CPLDirect.cpl_control_flow_ext(self.id, _src.id, _version, type) if not CPLDirect.cpl_is_ok(ret): raise Exception('Could not add control dependency: ' + CPLDirect.cpl_error_string(ret)) return not ret == S_DUPLICATE_IGNORED
def control_flow_to(self, dest, type=CONTROL_OP, version=None): ''' Add control flow edge of type from self to dest. If version is specified, then add flow to dest with explicit version, else add to most recent version. Allowed types: CPL.CONTROL_OP (default) CPL.CONTROL_START CPL.CONTROL_GENERIC is an alias for CPL.CONTROL_OP. ''' if version is None or version == VERSION_NONE: version = self.version() ret = CPLDirect.cpl_control_flow_ext(dest.id, self.id, version, type) if not CPLDirect.cpl_is_ok(ret): raise Exception('Could not add control dependency: ' + CPLDirect.cpl_error_string(ret)) return not ret == S_DUPLICATE_IGNORED