def GetChanges(output):
  # Split on lines, adding an END marker to simply add logic
  lines = output.split('\n')
  lines = FilterLinesIn(lines)
  lines.append('END')

  changes = []
  was = []
  now = []
  mode = ''
  last = None

  for line in lines:
    #print("LINE=%s" % line)
    if not line: continue

    elif line[0] == '<':
      if line[2:].strip() == '': continue
      # Ignore prototypes
      if len(line) > 10:
        words = line[2:].split()
        if len(words) == 2 and words[1][-1] == ';':
          if words[0] == 'struct' or words[0] == 'union':
            continue
      was.append(line[2:])
    elif line[0] == '>':
      if line[2:].strip() == '': continue
      if line[2:10] == '#include': continue
      now.append(line[2:])
    elif line[0] == '-':
      continue
    else:
      change = Change(line, was, now)
      was = []
      now = []
      if ValidChange(change):
        changes.append(change)
      if line == 'END':
        break

  return FilterChanges(changes)