Index: trunk/doc-rnd/hacking/renames =================================================================== --- trunk/doc-rnd/hacking/renames (revision 4993) +++ trunk/doc-rnd/hacking/renames (revision 4994) @@ -758,3 +758,9 @@ GetConnectionMemory -> pcb_rat_connection_alloc CONNECTION_LOOP -> PCB_CONNECTION_LOOP RAT_LOOP -> PCB_RAT_LOOP +rats_patch_append -> pcb_ratspatch_append +rats_patch_destroy -> pcb_ratspatch_destroy +rats_patch_append_optimize -> pcb_ratspatch_append_optimize +rats_patch_make_edited -> pcb_ratspatch_make_edited +rats_patch_apply -> pcb_ratspatch_apply +rats_patch_fexport -> pcb_ratspatch_fexport Index: trunk/src/board.c =================================================================== --- trunk/src/board.c (revision 4993) +++ trunk/src/board.c (revision 4994) @@ -45,7 +45,7 @@ free(pcb->Name); free(pcb->Filename); free(pcb->PrintFilename); - rats_patch_destroy(pcb); + pcb_ratspatch_destroy(pcb); pcb_data_free(pcb->Data); free(pcb->Data); /* release font symbols */ Index: trunk/src/netlist_act.c =================================================================== --- trunk/src/netlist_act.c (revision 4993) +++ trunk/src/netlist_act.c (revision 4994) @@ -91,13 +91,13 @@ } - rats_patch_append_optimize(PCB, RATP_DEL_CONN, pins[0], nets[0]->Name + 2, NULL); - rats_patch_append_optimize(PCB, RATP_DEL_CONN, pins[1], nets[1]->Name + 2, NULL); - rats_patch_append_optimize(PCB, RATP_ADD_CONN, pins[0], nets[1]->Name + 2, NULL); - rats_patch_append_optimize(PCB, RATP_ADD_CONN, pins[1], nets[0]->Name + 2, NULL); + pcb_ratspatch_append_optimize(PCB, RATP_DEL_CONN, pins[0], nets[0]->Name + 2, NULL); + pcb_ratspatch_append_optimize(PCB, RATP_DEL_CONN, pins[1], nets[1]->Name + 2, NULL); + pcb_ratspatch_append_optimize(PCB, RATP_ADD_CONN, pins[0], nets[1]->Name + 2, NULL); + pcb_ratspatch_append_optimize(PCB, RATP_ADD_CONN, pins[1], nets[0]->Name + 2, NULL); /* TODO: not very efficient to regenerate the whole list... */ - rats_patch_make_edited(PCB); + pcb_ratspatch_make_edited(PCB); ret = 0; quit:; @@ -133,7 +133,7 @@ } if (pin == NULL) { pin = pcb_lib_conn_new(net, (char *) pinname); - rats_patch_append_optimize(PCB, RATP_ADD_CONN, pin->ListEntry, net->Name + 2, NULL); + pcb_ratspatch_append_optimize(PCB, RATP_ADD_CONN, pin->ListEntry, net->Name + 2, NULL); } pcb_netlist_changed(0); Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 4993) +++ trunk/src/plug_io.c (revision 4994) @@ -352,7 +352,7 @@ pcb_attrib_put(PCB, "PCB::grid::unit", conf_core.editor.grid_unit->suffix); pcb_sort_netlist(); - rats_patch_make_edited(PCB); + pcb_ratspatch_make_edited(PCB); /* set route style to the first one, if the current one doesn't happen to match any. This way, "revert" won't change the route style. */ Index: trunk/src/rats_patch.c =================================================================== --- trunk/src/rats_patch.c (revision 4993) +++ trunk/src/rats_patch.c (revision 4994) @@ -41,7 +41,7 @@ "edited" }; -void rats_patch_append(pcb_board_t *pcb, pcb_rats_patch_op_t op, const char *id, const char *a1, const char *a2) +void pcb_ratspatch_append(pcb_board_t *pcb, pcb_rats_patch_op_t op, const char *id, const char *a1, const char *a2) { pcb_ratspatch_line_t *n; @@ -76,7 +76,7 @@ free(n->arg2.attrib_val); } -void rats_patch_destroy(pcb_board_t *pcb) +void pcb_ratspatch_destroy(pcb_board_t *pcb) { pcb_ratspatch_line_t *n, *next; @@ -87,7 +87,7 @@ } } -void rats_patch_append_optimize(pcb_board_t *pcb, pcb_rats_patch_op_t op, const char *id, const char *a1, const char *a2) +void pcb_ratspatch_append_optimize(pcb_board_t *pcb, pcb_rats_patch_op_t op, const char *id, const char *a1, const char *a2) { pcb_rats_patch_op_t seek_op; pcb_ratspatch_line_t *n; @@ -124,7 +124,7 @@ } quit:; - rats_patch_append(pcb, op, id, a1, a2); + pcb_ratspatch_append(pcb, op, id, a1, a2); } /* Unlink n from the list; if do_free is non-zero, also free fields and n */ @@ -242,7 +242,7 @@ } -int rats_patch_apply(pcb_board_t *pcb, pcb_ratspatch_line_t * patch) +int pcb_ratspatch_apply(pcb_board_t *pcb, pcb_ratspatch_line_t * patch) { switch (patch->op) { case RATP_ADD_CONN: @@ -256,7 +256,7 @@ return 0; } -void rats_patch_make_edited(pcb_board_t *pcb) +void pcb_ratspatch_make_edited(pcb_board_t *pcb) { pcb_ratspatch_line_t *n; @@ -263,7 +263,7 @@ netlist_free(&(pcb->NetlistLib[NETLIST_EDITED])); netlist_copy(&(pcb->NetlistLib[NETLIST_EDITED]), &(pcb->NetlistLib[NETLIST_INPUT])); for (n = pcb->NetlistPatches; n != NULL; n = n->next) - rats_patch_apply(pcb, n); + pcb_ratspatch_apply(pcb, n); } static pcb_lib_menu_t *rats_patch_find_net(pcb_board_t *pcb, const char *netname, int listidx) @@ -356,7 +356,7 @@ } } -int rats_patch_fexport(pcb_board_t *pcb, FILE *f, int fmt_pcb) +int pcb_ratspatch_fexport(pcb_board_t *pcb, FILE *f, int fmt_pcb) { fexport_t ctx; if (fmt_pcb) { @@ -432,7 +432,7 @@ a[3] = NULL; pcb_load_footprint(3, a, element->MarkX, element->MarkY); pcb_buffer_copy_to_layout(element->MarkX, element->MarkY); - rats_patch_append_optimize(PCB, RATP_CHANGE_ATTRIB, a[1], "footprint", fpname); + pcb_ratspatch_append_optimize(PCB, RATP_CHANGE_ATTRIB, a[1], "footprint", fpname); pcb_element_remove(element); } } @@ -482,7 +482,7 @@ pcb_message(PCB_MSG_DEFAULT, "Can't open netlist patch file %s for writing\n", fn); return 1; } - rats_patch_fexport(PCB, f, 0); + pcb_ratspatch_fexport(PCB, f, 0); fclose(f); return 0; } Index: trunk/src/rats_patch.h =================================================================== --- trunk/src/rats_patch.h (revision 4993) +++ trunk/src/rats_patch.h (revision 4994) @@ -55,20 +55,20 @@ const char *pcb_netlist_names[NUM_NETLISTS]; /* Allocate and append a patch line to the patch list */ -void rats_patch_append(pcb_board_t *pcb, pcb_rats_patch_op_t op, const char *id, const char *a1, const char *a2); +void pcb_ratspatch_append(pcb_board_t *pcb, pcb_rats_patch_op_t op, const char *id, const char *a1, const char *a2); /* Free the patch list and all memory claimed by patch list items */ -void rats_patch_destroy(pcb_board_t *pcb); +void pcb_ratspatch_destroy(pcb_board_t *pcb); -/* Same as rats_patch_append() but also optimize previous entries so that +/* Same as pcb_ratspatch_append() but also optimize previous entries so that redundant entries are removed */ -void rats_patch_append_optimize(pcb_board_t *pcb, pcb_rats_patch_op_t op, const char *id, const char *a1, const char *a2); +void pcb_ratspatch_append_optimize(pcb_board_t *pcb, pcb_rats_patch_op_t op, const char *id, const char *a1, const char *a2); /* Create [NETLIST_EDITED] from [NETLIST_INPUT] applying the patch */ -void rats_patch_make_edited(pcb_board_t *pcb); +void pcb_ratspatch_make_edited(pcb_board_t *pcb); /* apply a single patch record on [NETLIST_EDITED]; returns non-zero on failure */ -int rats_patch_apply(pcb_board_t *pcb, pcb_ratspatch_line_t * patch); +int pcb_ratspatch_apply(pcb_board_t *pcb, pcb_ratspatch_line_t * patch); /**** exporter ****/ @@ -75,7 +75,7 @@ /* Special text exporter: save all patch lines as an ordered list of text lines if fmt is non-zero, generate pcb savefile compatible lines, else generate a back annotation patch */ -int rats_patch_fexport(pcb_board_t *pcb, FILE * f, int fmt_pcb); +int pcb_ratspatch_fexport(pcb_board_t *pcb, FILE * f, int fmt_pcb); /* Generic, callback based exporter: */ Index: trunk/src_plugins/import_edif/import_edif.c =================================================================== --- trunk/src_plugins/import_edif/import_edif.c (revision 4993) +++ trunk/src_plugins/import_edif/import_edif.c (revision 4994) @@ -68,7 +68,7 @@ int ret = ReadEdifNetlist((char *)fn); if (ret == 0) { pcb_sort_netlist(); - rats_patch_make_edited(PCB); + pcb_ratspatch_make_edited(PCB); } return ret; } Index: trunk/src_plugins/import_netlist/import_netlist.c =================================================================== --- trunk/src_plugins/import_netlist/import_netlist.c (revision 4993) +++ trunk/src_plugins/import_netlist/import_netlist.c (revision 4994) @@ -154,7 +154,7 @@ else fclose(fp); pcb_sort_netlist(); - rats_patch_make_edited(PCB); + pcb_ratspatch_make_edited(PCB); return (0); } Index: trunk/src_plugins/io_lihata/read.c =================================================================== --- trunk/src_plugins/io_lihata/read.c (revision 4993) +++ trunk/src_plugins/io_lihata/read.c (revision 4994) @@ -901,13 +901,13 @@ nval = lht_dom_hash_get(np, "term"); if ((nval == NULL) || (nval->type != LHT_TEXT) || (*nval->data.text.value == '\0')) return -1; - rats_patch_append(pcb, RATP_ADD_CONN, nval->data.text.value, nnet->data.text.value, NULL); + pcb_ratspatch_append(pcb, RATP_ADD_CONN, nval->data.text.value, nnet->data.text.value, NULL); } else if (strcmp(np->name, "add_conn") == 0) { nval = lht_dom_hash_get(np, "term"); if ((nval == NULL) || (nval->type != LHT_TEXT) || (*nval->data.text.value == '\0')) return -1; - rats_patch_append(pcb, RATP_DEL_CONN, nval->data.text.value, nnet->data.text.value, NULL); + pcb_ratspatch_append(pcb, RATP_DEL_CONN, nval->data.text.value, nnet->data.text.value, NULL); } else if (strcmp(np->name, "change_attrib") == 0) { nkey = lht_dom_hash_get(np, "key"); @@ -916,7 +916,7 @@ nval = lht_dom_hash_get(np, "term"); if ((nval == NULL) || (nval->type != LHT_TEXT)) return -1; - rats_patch_append(pcb, RATP_CHANGE_ATTRIB, nnet->data.text.value, nkey->data.text.value, nval->data.text.value); + pcb_ratspatch_append(pcb, RATP_CHANGE_ATTRIB, nnet->data.text.value, nkey->data.text.value, nval->data.text.value); } } return 0; Index: trunk/src_plugins/io_pcb/file.c =================================================================== --- trunk/src_plugins/io_pcb/file.c (revision 4993) +++ trunk/src_plugins/io_pcb/file.c (revision 4994) @@ -358,7 +358,7 @@ { if (PCB->NetlistPatches != NULL) { fprintf(FP, "NetListPatch()\n(\n"); - rats_patch_fexport(PCB, FP, 1); + pcb_ratspatch_fexport(PCB, FP, 1); fprintf(FP, ")\n"); } } Index: trunk/src_plugins/io_pcb/parse_y.c =================================================================== --- trunk/src_plugins/io_pcb/parse_y.c (revision 4993) +++ trunk/src_plugins/io_pcb/parse_y.c (revision 4994) @@ -2842,19 +2842,19 @@ case 197: #line 1947 "parse_y.y" /* yacc.c:1646 */ - { rats_patch_append(yyPCB, RATP_ADD_CONN, (yyvsp[-2].string), (yyvsp[-1].string), NULL); free((yyvsp[-2].string)); free((yyvsp[-1].string)); } + { pcb_ratspatch_append(yyPCB, RATP_ADD_CONN, (yyvsp[-2].string), (yyvsp[-1].string), NULL); free((yyvsp[-2].string)); free((yyvsp[-1].string)); } #line 2847 "parse_y.c" /* yacc.c:1646 */ break; case 198: #line 1948 "parse_y.y" /* yacc.c:1646 */ - { rats_patch_append(yyPCB, RATP_DEL_CONN, (yyvsp[-2].string), (yyvsp[-1].string), NULL); free((yyvsp[-2].string)); free((yyvsp[-1].string)); } + { pcb_ratspatch_append(yyPCB, RATP_DEL_CONN, (yyvsp[-2].string), (yyvsp[-1].string), NULL); free((yyvsp[-2].string)); free((yyvsp[-1].string)); } #line 2853 "parse_y.c" /* yacc.c:1646 */ break; case 199: #line 1949 "parse_y.y" /* yacc.c:1646 */ - { rats_patch_append(yyPCB, RATP_CHANGE_ATTRIB, (yyvsp[-3].string), (yyvsp[-2].string), (yyvsp[-1].string)); free((yyvsp[-3].string)); free((yyvsp[-2].string)); free((yyvsp[-1].string)); } + { pcb_ratspatch_append(yyPCB, RATP_CHANGE_ATTRIB, (yyvsp[-3].string), (yyvsp[-2].string), (yyvsp[-1].string)); free((yyvsp[-3].string)); free((yyvsp[-2].string)); free((yyvsp[-1].string)); } #line 2859 "parse_y.c" /* yacc.c:1646 */ break; Index: trunk/src_plugins/io_pcb/parse_y.y =================================================================== --- trunk/src_plugins/io_pcb/parse_y.y (revision 4993) +++ trunk/src_plugins/io_pcb/parse_y.y (revision 4994) @@ -1944,9 +1944,9 @@ netpatch /* name style pin pin ... */ - : T_ADD_CONN '(' STRING STRING ')' { rats_patch_append(yyPCB, RATP_ADD_CONN, $3, $4, NULL); free($3); free($4); } - | T_DEL_CONN '(' STRING STRING ')' { rats_patch_append(yyPCB, RATP_DEL_CONN, $3, $4, NULL); free($3); free($4); } - | T_CHANGE_ATTRIB '(' STRING STRING STRING ')' { rats_patch_append(yyPCB, RATP_CHANGE_ATTRIB, $3, $4, $5); free($3); free($4); free($5); } + : T_ADD_CONN '(' STRING STRING ')' { pcb_ratspatch_append(yyPCB, RATP_ADD_CONN, $3, $4, NULL); free($3); free($4); } + | T_DEL_CONN '(' STRING STRING ')' { pcb_ratspatch_append(yyPCB, RATP_DEL_CONN, $3, $4, NULL); free($3); free($4); } + | T_CHANGE_ATTRIB '(' STRING STRING STRING ')' { pcb_ratspatch_append(yyPCB, RATP_CHANGE_ATTRIB, $3, $4, $5); free($3); free($4); free($5); } ;