def difference(self, other): difference = gl_XML.gl_api(None) if "enum" in self.elts: for key, val in self.api.enums_by_name.iteritems(): if key not in other.enums_by_name: difference.enums_by_name[key] = val else: self._check_enum(val, other.enums_by_name[key]) if "type" in self.elts: for key, val in self.api.types_by_name.iteritems(): if key not in other.types_by_name: difference.types_by_name[key] = val else: self._check_type(val, other.types_by_name[key]) if "function" in self.elts: for key, val in self.api.functions_by_name.iteritems(): if key not in other.functions_by_name: difference.functions_by_name[key] = val else: self._check_function(val, other.functions_by_name[key], False) return difference
def union(self, other): union = gl_XML.gl_api(None) if "enum" in self.elts: union.enums_by_name = other.enums_by_name.copy() for key, val in self.api.enums_by_name.iteritems(): if key not in union.enums_by_name: union.enums_by_name[key] = val else: self._check_enum(val, other.enums_by_name[key]) if "type" in self.elts: union.types_by_name = other.types_by_name.copy() for key, val in self.api.types_by_name.iteritems(): if key not in union.types_by_name: union.types_by_name[key] = val else: self._check_type(val, other.types_by_name[key]) if "function" in self.elts: union.functions_by_name = other.functions_by_name.copy() for key, val in self.api.functions_by_name.iteritems(): if key not in union.functions_by_name: union.functions_by_name[key] = val else: self._check_function(val, other.functions_by_name[key]) return union
def intersection(self, other): intersection = gl_XML.gl_api(None) if "enum" in self.elts: for key, val in self.api.enums_by_name.iteritems(): if key in other.enums_by_name: self._check_enum(val, other.enums_by_name[key]) intersection.enums_by_name[key] = val if "type" in self.elts: for key, val in self.api.types_by_name.iteritems(): if key in other.types_by_name: self._check_type(val, other.types_by_name[key]) intersection.types_by_name[key] = val if "function" in self.elts: for key, val in self.api.functions_by_name.iteritems(): if key in other.functions_by_name: self._check_function(val, other.functions_by_name[key]) intersection.functions_by_name[key] = val return intersection