refactor line_emit into line.c