def print_fieldrefs(doc, loader, stream):<EOL>
obj = extend_and_specialize(doc, loader)<EOL>primitives = set(("<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>"))<EOL>stream.write("<STR_LIT>")<EOL>for entry in obj:<EOL><INDENT>if entry.get("<STR_LIT>"):<EOL><INDENT>continue<EOL><DEDENT>if entry["<STR_LIT:type>"] == "<STR_LIT>":<EOL><INDENT>label = shortname(entry["<STR_LIT:name>"])<EOL>for field in entry.get("<STR_LIT>", []):<EOL><INDENT>found = set()  <EOL>field_name = shortname(field["<STR_LIT:name>"])<EOL>replace_type(field["<STR_LIT:type>"], {}, loader, found, find_embeds=False)<EOL>for each_type in found:<EOL><INDENT>if each_type not in primitives:<EOL><INDENT>stream.write(<EOL>"<STR_LIT>"<EOL>% (label, shortname(each_type), field_name))<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>stream.write("<STR_LIT>")<EOL>
Write a GraphViz graph of the relationships between the fields.