Index: trunk/src/action.c =================================================================== --- trunk/src/action.c (revision 915) +++ trunk/src/action.c (revision 916) @@ -3283,6 +3283,7 @@ return 0; } +#ifdef BA_TODO /* --------------------------------------------------------------------------- */ static const char renumber_syntax[] = "Renumber()\n" @@ -3637,8 +3638,8 @@ free (cnt_list); return 0; } +#endif - /* --------------------------------------------------------------------------- */ static const char ripup_syntax[] = "RipUp(All|Selected|Element)"; @@ -6083,7 +6084,11 @@ if (PCB->Netlistname) free (PCB->Netlistname); PCB->Netlistname = StripWhiteSpaceAndDup (name); - FreeLibraryMemory (&PCB->NetlistLib); + { + int i; + for(i = 0; i < NUM_NETLISTS; i++) + FreeLibraryMemory (&(PCB->NetlistLib[i])); + } if (!ImportNetlist (PCB->Netlistname)) NetlistChanged (1); } @@ -8375,9 +8380,11 @@ {"RemoveSelected", 0, ActionRemoveSelected, removeselected_help, removeselected_syntax} , +#ifdef BA_TODO {"Renumber", 0, ActionRenumber, renumber_help, renumber_syntax} , +#endif {"RipUp", 0, ActionRipUp, ripup_help, ripup_syntax} , Index: trunk/src/autoplace.c =================================================================== --- trunk/src/autoplace.c (revision 915) +++ trunk/src/autoplace.c (revision 916) @@ -762,7 +762,7 @@ * structure the way the final routing * is supposed to look */ - Nets = ProcNetlist (&PCB->NetlistLib); + Nets = ProcNetlist (&(PCB->NetlistLib[NETLIST_EDITED])); if (!Nets) { Message (_("Can't add rat lines because no netlist is loaded.\n")); Index: trunk/src/edif.c =================================================================== --- trunk/src/edif.c (revision 915) +++ trunk/src/edif.c (revision 916) @@ -177,7 +177,7 @@ char* buf; char* p; LibraryEntryTypePtr entry; - LibraryMenuTypePtr menu = GetLibraryMenuMemory (&PCB->NetlistLib); + LibraryMenuTypePtr menu = GetLibraryMenuMemory (&(PCB->NetlistLib[NETLIST_EDITED])); if ( !name->str1 ) { Index: trunk/src/file.c =================================================================== --- trunk/src/file.c (revision 915) +++ trunk/src/file.c (revision 916) @@ -246,7 +246,7 @@ sort_netlist () { netlist_sort_offset = 2; - sort_library (&(PCB->NetlistLib)); + sort_library (&(PCB->NetlistLib[NETLIST_INPUT])); netlist_sort_offset = 0; } @@ -697,14 +697,14 @@ WritePCBNetlistData (FILE * FP) { /* write out the netlist if it exists */ - if (PCB->NetlistLib.MenuN) + if (PCB->NetlistLib[NETLIST_INPUT].MenuN) { int n, p; fprintf (FP, "NetList()\n(\n"); - for (n = 0; n < PCB->NetlistLib.MenuN; n++) + for (n = 0; n < PCB->NetlistLib[NETLIST_INPUT].MenuN; n++) { - LibraryMenuTypePtr menu = &PCB->NetlistLib.Menu[n]; + LibraryMenuTypePtr menu = &PCB->NetlistLib[NETLIST_INPUT].Menu[n]; fprintf (FP, "\tNet("); PrintQuotedString(FP, &menu->Name[2]); fprintf (FP, " "); @@ -731,7 +731,7 @@ { if (PCB->NetlistPatches != NULL) { rats_patch_line_t *n; - fprintf (FP, "NetList()\n(\n"); + fprintf (FP, "NetListPatch()\n(\n"); for(n = PCB->NetlistPatches; n != NULL; n = n->next) { switch(n->op) { case RATP_ADD_CONN: fprintf (FP, "\tadd_conn(\"%s\" \"%s\")\n", n->id, n->arg1.net_name); break; @@ -1448,7 +1448,7 @@ i++; if (kind == 0) { - menu = GetLibraryMenuMemory (&PCB->NetlistLib, NULL); + menu = GetLibraryMenuMemory (&PCB->NetlistLib[NETLIST_INPUT], NULL); menu->Name = strdup (temp); menu->flag = 1; kind++; Index: trunk/src/global.h =================================================================== --- trunk/src/global.h (revision 915) +++ trunk/src/global.h (revision 916) @@ -485,7 +485,13 @@ LibraryMenuTypePtr Menu; /* the entries */ } LibraryType, *LibraryTypePtr; +enum { + NETLIST_INPUT = 0, /* index of the original netlist as imported */ + NETLIST_EDITED = 0, /* index of the netlist produced by applying netlist patches on [NETLIST_INPUT] */ + NUM_NETLISTS /* so that we know how many netlists we are dealing with */ +}; + /* The PCBType struct holds information about board layout most of which is | saved with the layout. A new PCB layout struct is first initialized | with values from the user configurable Settings struct and then reset @@ -532,7 +538,7 @@ FontType Font; LayerGroupType LayerGroups; RouteStyleType RouteStyle[NUM_STYLES]; - LibraryType NetlistLib; + LibraryType NetlistLib[NUM_NETLISTS]; rats_patch_line_t *NetlistPatches, *NetlistPatchLast; AttributeListType Attributes; DataTypePtr Data; /* entire database */ Index: trunk/src/hid/gtk/gui-netlist-window.c =================================================================== --- trunk/src/hid/gtk/gui-netlist-window.c (revision 915) +++ trunk/src/hid/gtk/gui-netlist-window.c (revision 916) @@ -353,7 +353,7 @@ (GDestroyNotify) gtk_tree_row_reference_free); - MENU_LOOP (&PCB->NetlistLib); + MENU_LOOP (&PCB->NetlistLib[NETLIST_EDITED]); { if (!menu->Name) continue; @@ -705,7 +705,7 @@ /* No point in putting up the window if no netlist is loaded. */ - if (!PCB->NetlistLib.MenuN) + if (!PCB->NetlistLib[NETLIST_EDITED].MenuN) return; if (netlist_window) @@ -1008,7 +1008,7 @@ /* XXX Check if the select callback does this for us */ if (init_nodes) - node_model_update ((&PCB->NetlistLib)->Menu); + node_model_update ((&PCB->NetlistLib[NETLIST_EDITED])->Menu); } static gint Index: trunk/src/hid/gtk/gui-output-events.c =================================================================== --- trunk/src/hid/gtk/gui-output-events.c (revision 915) +++ trunk/src/hid/gtk/gui-output-events.c (revision 916) @@ -419,7 +419,7 @@ return NULL; /* Find netlist entry */ - MENU_LOOP (&PCB->NetlistLib); + MENU_LOOP (&PCB->NetlistLib[NETLIST_EDITED]); { if (!menu->Name) continue; Index: trunk/src/hid/lesstif/netlist.c =================================================================== --- trunk/src/hid/lesstif/netlist.c (revision 915) +++ trunk/src/hid/lesstif/netlist.c (revision 916) @@ -48,7 +48,7 @@ static void pick_net (int pick) { - LibraryMenuType *menu = PCB->NetlistLib.Menu + pick; + LibraryMenuType *menu = PCB->NetlistLib[NETLIST_EDITED].Menu + pick; int i; if (pick == last_pick) @@ -72,7 +72,7 @@ { XmString str; int pos = cbs->item_position; - LibraryMenuTypePtr net = & (PCB->NetlistLib.Menu[pos - 1]); + LibraryMenuTypePtr net = & (PCB->NetlistLib[NETLIST_EDITED].Menu[pos - 1]); char *name = net->Name; if (name[0] == ' ') { @@ -178,7 +178,7 @@ hid_actionl ("connection", "reset", NULL); for (i=0; iNetlistLib.Menu[posl[i] - 1]); + LibraryMenuTypePtr net = & (PCB->NetlistLib[NETLIST_EDITED].Menu[posl[i] - 1]); v(net, posl[i]); } n = 0; @@ -224,7 +224,7 @@ static void netnode_browse (Widget w, XtPointer v, XmListCallbackStruct * cbs) { - LibraryMenuType *menu = PCB->NetlistLib.Menu + last_pick; + LibraryMenuType *menu = PCB->NetlistLib[NETLIST_EDITED].Menu + last_pick; char *name = menu->Entry[cbs->item_position - 1].ListEntry; char *ename, *pname; @@ -386,7 +386,7 @@ LesstifNetlistChanged (int argc, char **argv, Coord x, Coord y) { int i; - if (!PCB->NetlistLib.MenuN) + if (!PCB->NetlistLib[NETLIST_EDITED].MenuN) return 0; if (build_netlist_dialog ()) return 0; @@ -394,13 +394,13 @@ if (netlist_strings) free (netlist_strings); netlist_strings = - (XmString *) malloc (PCB->NetlistLib.MenuN * sizeof (XmString)); - for (i = 0; i < PCB->NetlistLib.MenuN; i++) + (XmString *) malloc (PCB->NetlistLib[NETLIST_EDITED].MenuN * sizeof (XmString)); + for (i = 0; i < PCB->NetlistLib[NETLIST_EDITED].MenuN; i++) netlist_strings[i] = - XmStringCreatePCB (PCB->NetlistLib.Menu[i].Name); + XmStringCreatePCB (PCB->NetlistLib[NETLIST_EDITED].Menu[i].Name); n = 0; stdarg (XmNitems, netlist_strings); - stdarg (XmNitemCount, PCB->NetlistLib.MenuN); + stdarg (XmNitemCount, PCB->NetlistLib[NETLIST_EDITED].MenuN); XtSetValues (netlist_list, args, n); pick_net (0); return 0; Index: trunk/src/hid/nelma/nelma.c =================================================================== --- trunk/src/hid/nelma/nelma.c (revision 915) +++ trunk/src/hid/nelma/nelma.c (revision 916) @@ -333,7 +333,7 @@ const char *ext; - netlist = PCB->NetlistLib; + netlist = PCB->NetlistLib[NETLIST_EDITED]; fprintf(out, "\n/* **** Nets **** */\n\n"); @@ -387,7 +387,7 @@ if (full) { fprintf(out, "\tobjects = {\n"); - netlist = PCB->NetlistLib; + netlist = PCB->NetlistLib[NETLIST_EDITED]; for (n = 0; n < netlist.MenuN; n++) { net = &netlist.Menu[n]; @@ -501,7 +501,7 @@ int n, m; - netlist = PCB->NetlistLib; + netlist = PCB->NetlistLib[NETLIST_EDITED]; fprintf(out, "\n/* **** Objects **** */\n\n"); Index: trunk/src/mymem.c =================================================================== --- trunk/src/mymem.c (revision 915) +++ trunk/src/mymem.c (revision 916) @@ -689,7 +689,8 @@ /* release font symbols */ for (i = 0; i <= MAX_FONTPOSITION; i++) free (pcb->Font.Symbol[i].Line); - FreeLibraryMemory (&pcb->NetlistLib); + for(i = 0; i < NUM_NETLISTS; i++) + FreeLibraryMemory (&(pcb->NetlistLib[i])); FreeAttributeListMemory (&pcb->Attributes); /* clear struct */ memset (pcb, 0, sizeof (PCBType)); Index: trunk/src/netlist.c =================================================================== --- trunk/src/netlist.c (revision 915) +++ trunk/src/netlist.c (revision 916) @@ -72,14 +72,14 @@ RCSID ("$Id$"); /* - int PCB->NetlistLib.MenuN - char * PCB->NetlistLib.Menu[i].Name + int PCB->NetlistLib[n].MenuN + char * PCB->NetlistLib[n].Menu[i].Name [0] == '*' (ok for rats) or ' ' (skip for rats) [1] == unused [2..] actual name - char * PCB->NetlistLib.Menu[i].Style - int PCB->NetlistLib.Menu[i].EntryN - char * PCB->NetlistLib.Menu[i].Entry[j].ListEntry + char * PCB->NetlistLib[n].Menu[i].Style + int PCB->NetlistLib[n].Menu[i].EntryN + char * PCB->NetlistLib[n].Menu[i].Entry[j].ListEntry */ typedef void (*NFunc) (LibraryMenuType *, LibraryEntryType *); @@ -106,14 +106,14 @@ { int i, j; /*printf("nodename [%s]\n", nodename);*/ - for (i=0; iNetlistLib.MenuN; i++) + for (i=0; iNetlistLib[NETLIST_EDITED].MenuN; i++) { - for (j=0; jNetlistLib.Menu[i].EntryN; j++) + for (j=0; jNetlistLib[NETLIST_EDITED].Menu[i].EntryN; j++) { - if (strcmp (PCB->NetlistLib.Menu[i].Entry[j].ListEntry, nodename) == 0) + if (strcmp (PCB->NetlistLib[NETLIST_EDITED].Menu[i].Entry[j].ListEntry, nodename) == 0) { /*printf(" in [%s]\n", PCB->NetlistLib.Menu[i].Name);*/ - return & (PCB->NetlistLib.Menu[i]); + return & (PCB->NetlistLib[NETLIST_EDITED].Menu[i]); } } } @@ -130,11 +130,11 @@ /* Looks like we were passed an internal netname, skip the prefix */ netname += 2; } - for (i=0; iNetlistLib.MenuN; i++) + for (i=0; iNetlistLib[NETLIST_EDITED].MenuN; i++) { - if (strcmp (PCB->NetlistLib.Menu[i].Name + 2, netname) == 0) + if (strcmp (PCB->NetlistLib[NETLIST_EDITED].Menu[i].Name + 2, netname) == 0) { - return & (PCB->NetlistLib.Menu[i]); + return & (PCB->NetlistLib[NETLIST_EDITED].Menu[i]); } } return 0; @@ -206,7 +206,8 @@ if (net == 0) { /* Clear the entire netlist. */ - FreeLibraryMemory (&PCB->NetlistLib); + for(ni = 0; ni < NUM_NETLISTS; ni++) + FreeLibraryMemory (&(PCB->NetlistLib[ni])); } else if (pin == 0) { @@ -250,7 +251,7 @@ netlist_add (const char *netname, const char *pinname) { int ni, pi; - LibraryType *netlist = &PCB->NetlistLib; + LibraryType *netlist = &PCB->NetlistLib[NETLIST_INPUT]; LibraryMenuType *net = NULL; LibraryEntryType *pin = NULL; @@ -430,9 +431,9 @@ { int result; use_re = 1; - for (i = 0; i < PCB->NetlistLib.MenuN; i++) + for (i = 0; i < PCB->NetlistLib[NETLIST_EDITED].MenuN; i++) { - net = PCB->NetlistLib.Menu + i; + net = PCB->NetlistLib[NETLIST_EDITED].Menu + i; if (strcasecmp (argv[1], net->Name + 2) == 0) use_re = 0; } @@ -463,9 +464,9 @@ } #endif - for (i = PCB->NetlistLib.MenuN-1; i >= 0; i--) + for (i = PCB->NetlistLib[NETLIST_EDITED].MenuN-1; i >= 0; i--) { - net = PCB->NetlistLib.Menu + i; + net = PCB->NetlistLib[NETLIST_EDITED].Menu + i; if (argc > 1) { Index: trunk/src/rats.c =================================================================== --- trunk/src/rats.c (revision 915) +++ trunk/src/rats.c (revision 916) @@ -744,7 +744,7 @@ * structure the way the final routing * is supposed to look */ - Wantlist = ProcNetlist (&PCB->NetlistLib); + Wantlist = ProcNetlist (&(PCB->NetlistLib[NETLIST_EDITED])); if (!Wantlist) { Message (_("Can't add rat lines because no netlist is loaded.\n")); @@ -840,7 +840,7 @@ * structure the way the final routing * is supposed to look */ - Wantlist = ProcNetlist (&PCB->NetlistLib); + Wantlist = ProcNetlist (&(PCB->NetlistLib[NETLIST_EDITED])); if (!Wantlist) { Message (_("Can't add rat lines because no netlist is loaded.\n")); @@ -895,7 +895,7 @@ if (name == NULL) return -1; - MENU_LOOP (&PCB->NetlistLib); + MENU_LOOP (&(PCB->NetlistLib[NETLIST_EDITED])); { if (menu->Name && (strcmp (menu->Name, name) == 0)) return 1; @@ -999,7 +999,7 @@ sprintf (ratname, " ratDrawn%i", ++ratDrawn); } - menu = GetLibraryMenuMemory (&PCB->NetlistLib, NULL); + menu = GetLibraryMenuMemory (&(PCB->NetlistLib[NETLIST_EDITED]), NULL); menu->Name = strdup (ratname); entry = GetLibraryEntryMemory (menu); entry->ListEntry = strdup (name1); Index: trunk/src/report.c =================================================================== --- trunk/src/report.c (revision 915) +++ trunk/src/report.c (revision 916) @@ -608,10 +608,10 @@ ResetConnections (true); IncrementUndoSerialNumber (); - for (ni = 0; ni < PCB->NetlistLib.MenuN; ni++) + for (ni = 0; ni < PCB->NetlistLib[NETLIST_EDITED].MenuN; ni++) { - char *netname = PCB->NetlistLib.Menu[ni].Name + 2; - char *ename = PCB->NetlistLib.Menu[ni].Entry[0].ListEntry; + char *netname = PCB->NetlistLib[NETLIST_EDITED].Menu[ni].Name + 2; + char *ename = PCB->NetlistLib[NETLIST_EDITED].Menu[ni].Entry[0].ListEntry; char *pname; bool got_one = 0; @@ -723,12 +723,12 @@ if (ename && pname) { n = Concat (ename, "-", pname, NULL); - for (ni = 0; ni < PCB->NetlistLib.MenuN; ni++) - for (nei = 0; nei < PCB->NetlistLib.Menu[ni].EntryN; nei++) + for (ni = 0; ni < PCB->NetlistLib[NETLIST_EDITED].MenuN; ni++) + for (nei = 0; nei < PCB->NetlistLib[NETLIST_EDITED].Menu[ni].EntryN; nei++) { - if (strcmp (PCB->NetlistLib.Menu[ni].Entry[nei].ListEntry, n) == 0) + if (strcmp (PCB->NetlistLib[NETLIST_EDITED].Menu[ni].Entry[nei].ListEntry, n) == 0) { - netname = PCB->NetlistLib.Menu[ni].Name + 2; + netname = PCB->NetlistLib[NETLIST_EDITED].Menu[ni].Name + 2; goto got_net_name; /* four for loops deep */ } } @@ -748,12 +748,12 @@ if (ename && pname) { n = Concat (ename, "-", pname, NULL); - for (ni = 0; ni < PCB->NetlistLib.MenuN; ni++) - for (nei = 0; nei < PCB->NetlistLib.Menu[ni].EntryN; nei++) + for (ni = 0; ni < PCB->NetlistLib[NETLIST_EDITED].MenuN; ni++) + for (nei = 0; nei < PCB->NetlistLib[NETLIST_EDITED].Menu[ni].EntryN; nei++) { - if (strcmp (PCB->NetlistLib.Menu[ni].Entry[nei].ListEntry, n) == 0) + if (strcmp (PCB->NetlistLib[NETLIST_EDITED].Menu[ni].Entry[nei].ListEntry, n) == 0) { - netname = PCB->NetlistLib.Menu[ni].Name + 2; + netname = PCB->NetlistLib[NETLIST_EDITED].Menu[ni].Name + 2; goto got_net_name; /* four for loops deep */ } } @@ -810,9 +810,9 @@ #if defined(USE_RE) use_re = 1; - for (i = 0; i < PCB->NetlistLib.MenuN; i++) + for (i = 0; i < PCB->NetlistLib[NETLIST_EDITED].MenuN; i++) { - net = PCB->NetlistLib.Menu + i; + net = PCB->NetlistLib[NETLIST_EDITED].Menu + i; if (strcasecmp (tofind, net->Name + 2) == 0) use_re = 0; } @@ -842,9 +842,9 @@ } #endif - for (i = 0; i < PCB->NetlistLib.MenuN; i++) + for (i = 0; i < PCB->NetlistLib[NETLIST_EDITED].MenuN; i++) { - net = PCB->NetlistLib.Menu + i; + net = PCB->NetlistLib[NETLIST_EDITED].Menu + i; #if defined(USE_RE) if (use_re) Index: trunk/src/select.c =================================================================== --- trunk/src/select.c (revision 915) +++ trunk/src/select.c (revision 916) @@ -998,7 +998,7 @@ InitConnectionLookup (); changed = ResetConnections (true) || changed; - MENU_LOOP (&PCB->NetlistLib); + MENU_LOOP (&(PCB->NetlistLib[NETLIST_EDITED])); { Cardinal i; LibraryEntryType *entry;