Index: config_gram.y =================================================================== --- config_gram.y (revision 1045) +++ config_gram.y (working copy) @@ -64,6 +64,8 @@ static int parse_cmdbits(OPCODE * op); static int pin_name; +static AVRPART * parent_part = NULL; +static FILE* dot_parts; %} %token K_READ @@ -248,7 +250,17 @@ %% configuration : - /* empty */ | config + /* empty */ | + { + char buf[1024]; + strcpy(buf,infile); + strcat(buf,".parts.dot"); + dot_parts = fopen(buf,"w"); + fprintf(dot_parts," digraph parts { rankdir=LR; ordering=out; node [shape=box,style=filled];\n"); + } config { + fprintf(dot_parts," }\n"); + fclose(dot_parts); + } ; config : @@ -403,7 +415,21 @@ lrmv_d(part_list, existing_part); avr_free_part(existing_part); } - PUSH(part_list, current_part); + PUSH(part_list, current_part); + { + int lines = lineno-current_part->lineno; + if (lines > 255) lines = 255; + fprintf(dot_parts," \"%-16s\" [label=\"%s\\n%02x %02x %02x\",fillcolor=\"#ff%02x%02x\"];\n", + current_part->id, + current_part->id, + current_part->signature[0], + current_part->signature[1], + current_part->signature[2], + 255-lines, + 255-lines); + if(parent_part!=NULL) + fprintf(dot_parts," \"%-16s\" -> \"%-16s\";\n",parent_part->id,current_part->id); + } current_part = NULL; } ; @@ -414,10 +440,11 @@ current_part = avr_new_part(); strcpy(current_part->config_file, infile); current_part->lineno = lineno; + parent_part = NULL; } | K_PART K_PARENT TKN_STRING { - AVRPART * parent_part = locate_part(part_list, $3->value.string); + parent_part = locate_part(part_list, $3->value.string); if (parent_part == NULL) { fprintf(stderr, "%s: error at %s:%d: can't find parent part",