Corrected an issue that prevents "cells list <file>" from reporting
empty cells (this does not solve the problem at hand, but is a part of it).
This commit is contained in:
parent
202ea0431f
commit
035fef5c72
136
base/objlist.c
136
base/objlist.c
|
|
@ -596,65 +596,65 @@ int freeprop(struct hashlist *p)
|
||||||
|
|
||||||
void CellDelete(char *name, int fnum)
|
void CellDelete(char *name, int fnum)
|
||||||
{
|
{
|
||||||
/* delete all the contents of cell 'name', and remove 'name' from
|
/* delete all the contents of cell 'name', and remove 'name' from
|
||||||
the cell hash table. NOTE: this procedure does not care or check
|
the cell hash table. NOTE: this procedure does not care or check
|
||||||
if 'name' has been instanced anywhere. It is assumed that if this
|
if 'name' has been instanced anywhere. It is assumed that if this
|
||||||
is the case, the user will (quickly) define a new cell of that name.
|
is the case, the user will (quickly) define a new cell of that name.
|
||||||
*/
|
*/
|
||||||
struct objlist *ob, *obnext;
|
struct objlist *ob, *obnext;
|
||||||
struct nlist *tp;
|
struct nlist *tp;
|
||||||
|
|
||||||
tp = LookupCellFile(name, fnum);
|
tp = LookupCellFile(name, fnum);
|
||||||
if (tp == NULL) {
|
if (tp == NULL) {
|
||||||
Printf ("No cell '%s' found.\n", name);
|
Printf ("No cell '%s' found.\n", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HashIntDelete(name, fnum, &cell_dict);
|
HashIntDelete(name, fnum, &cell_dict);
|
||||||
/* now make sure that we free all the fields of the nlist struct */
|
/* now make sure that we free all the fields of the nlist struct */
|
||||||
if (tp->name != NULL) FREE(tp->name);
|
if (tp->name != NULL) FREE(tp->name);
|
||||||
HashKill(&(tp->objdict));
|
HashKill(&(tp->objdict));
|
||||||
HashKill(&(tp->instdict));
|
HashKill(&(tp->instdict));
|
||||||
RecurseHashTable(&(tp->propdict), freeprop);
|
RecurseHashTable(&(tp->propdict), freeprop);
|
||||||
HashKill(&(tp->propdict));
|
HashKill(&(tp->propdict));
|
||||||
FreeNodeNames(tp);
|
FreeNodeNames(tp);
|
||||||
ob = tp->cell;
|
ob = tp->cell;
|
||||||
while (ob != NULL) {
|
while (ob != NULL) {
|
||||||
obnext = ob->next;
|
obnext = ob->next;
|
||||||
FreeObject (ob);
|
FreeObject (ob);
|
||||||
ob = obnext;
|
ob = obnext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int PrintCellHashTableElement(struct hashlist *p)
|
static int PrintCellHashTableElement(struct hashlist *p)
|
||||||
{
|
{
|
||||||
struct nlist *ptr;
|
struct nlist *ptr;
|
||||||
|
|
||||||
ptr = (struct nlist *)(p->ptr);
|
ptr = (struct nlist *)(p->ptr);
|
||||||
if ((TopFile >= 0) && (ptr->file != TopFile)) return 1;
|
if ((TopFile >= 0) && (ptr->file != TopFile)) return 1;
|
||||||
|
|
||||||
if (ptr->class != CLASS_SUBCKT) {
|
if ((ptr->class != CLASS_SUBCKT) && (ptr->class != CLASS_MODULE)) {
|
||||||
/* only print primitive cells if Debug is enabled */
|
/* only print primitive cells if Debug is enabled */
|
||||||
if (Debug == 1) Printf("Cell: %s (instanced %d times); Primitive\n",
|
if (Debug == 1) Printf("Cell: %s (instanced %d times); Primitive\n",
|
||||||
ptr->name, ptr->number);
|
ptr->name, ptr->number);
|
||||||
else if (Debug == 3) { /* list */
|
else if (Debug == 3) { /* list */
|
||||||
#ifdef TCL_NETGEN
|
#ifdef TCL_NETGEN
|
||||||
Tcl_AppendElement(netgeninterp, ptr->name);
|
Tcl_AppendElement(netgeninterp, ptr->name);
|
||||||
#else
|
#else
|
||||||
Printf("%s ", ptr->name);
|
Printf("%s ", ptr->name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((Debug == 2) || (Debug == 3)) { /* list only */
|
else if ((Debug == 2) || (Debug == 3)) { /* list only */
|
||||||
#ifdef TCL_NETGEN
|
#ifdef TCL_NETGEN
|
||||||
Tcl_AppendElement(netgeninterp, ptr->name);
|
Tcl_AppendElement(netgeninterp, ptr->name);
|
||||||
#else
|
#else
|
||||||
Printf("%s ", ptr->name);
|
Printf("%s ", ptr->name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Printf("Cell: %s (instanced %d times)\n",ptr->name,ptr->number);
|
Printf("Cell: %s (instanced %d times)\n", ptr->name, ptr->number);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the contents of the cell hash table. */
|
/* Print the contents of the cell hash table. */
|
||||||
|
|
@ -663,65 +663,65 @@ static int PrintCellHashTableElement(struct hashlist *p)
|
||||||
|
|
||||||
void PrintCellHashTable(int full, int filenum)
|
void PrintCellHashTable(int full, int filenum)
|
||||||
{
|
{
|
||||||
int total, bins;
|
int total, bins;
|
||||||
int OldDebug;
|
int OldDebug;
|
||||||
|
|
||||||
if ((filenum == -1) && (Circuit1 != NULL) && (Circuit2 != NULL)) {
|
if ((filenum == -1) && (Circuit1 != NULL) && (Circuit2 != NULL)) {
|
||||||
PrintCellHashTable(full, Circuit1->file);
|
PrintCellHashTable(full, Circuit1->file);
|
||||||
PrintCellHashTable(full, Circuit2->file);
|
PrintCellHashTable(full, Circuit2->file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TopFile = filenum;
|
TopFile = filenum;
|
||||||
|
|
||||||
bins = RecurseHashTable(&cell_dict, CountHashTableBinsUsed);
|
bins = RecurseHashTable(&cell_dict, CountHashTableBinsUsed);
|
||||||
total = RecurseHashTable(&cell_dict, CountHashTableEntries);
|
total = RecurseHashTable(&cell_dict, CountHashTableEntries);
|
||||||
if (full < 2)
|
if (full < 2)
|
||||||
Printf("Hash table: %d of %d bins used; %d cells total (%.2f per bin)\n",
|
Printf("Hash table: %d of %d bins used; %d cells total (%.2f per bin)\n",
|
||||||
bins, CELLHASHSIZE, total, (bins == 0) ? 0 :
|
bins, CELLHASHSIZE, total, (bins == 0) ? 0 :
|
||||||
(float)((float)total / (float)bins));
|
(float)((float)total / (float)bins));
|
||||||
|
|
||||||
OldDebug = Debug;
|
OldDebug = Debug;
|
||||||
Debug = full;
|
Debug = full;
|
||||||
RecurseHashTable(&cell_dict, PrintCellHashTableElement);
|
RecurseHashTable(&cell_dict, PrintCellHashTableElement);
|
||||||
Debug = OldDebug;
|
Debug = OldDebug;
|
||||||
#ifndef TCL_NETGEN
|
#ifndef TCL_NETGEN
|
||||||
if (full >= 2) Printf("\n");
|
if (full >= 2) Printf("\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nlist *FirstCell(void)
|
struct nlist *FirstCell(void)
|
||||||
{
|
{
|
||||||
return((struct nlist *)HashFirst(&cell_dict));
|
return((struct nlist *)HashFirst(&cell_dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nlist *NextCell(void)
|
struct nlist *NextCell(void)
|
||||||
{
|
{
|
||||||
return((struct nlist *)HashNext(&cell_dict));
|
return((struct nlist *)HashNext(&cell_dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ClearDumpedElement(struct hashlist *np)
|
static int ClearDumpedElement(struct hashlist *np)
|
||||||
{
|
{
|
||||||
struct nlist *p;
|
struct nlist *p;
|
||||||
|
|
||||||
p = (struct nlist *)(np->ptr);
|
p = (struct nlist *)(np->ptr);
|
||||||
p->dumped = 0;
|
p->dumped = 0;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearDumpedList(void)
|
void ClearDumpedList(void)
|
||||||
{
|
{
|
||||||
RecurseHashTable(&cell_dict, ClearDumpedElement);
|
RecurseHashTable(&cell_dict, ClearDumpedElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RecurseCellHashTable(int (*foo)(struct hashlist *np))
|
int RecurseCellHashTable(int (*foo)(struct hashlist *np))
|
||||||
{
|
{
|
||||||
return RecurseHashTable(&cell_dict, foo);
|
return RecurseHashTable(&cell_dict, foo);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RecurseCellFileHashTable(int (*foo)(struct hashlist *, int), int value)
|
int RecurseCellFileHashTable(int (*foo)(struct hashlist *, int), int value)
|
||||||
{
|
{
|
||||||
return RecurseHashTableValue(&cell_dict, foo, value);
|
return RecurseHashTableValue(&cell_dict, foo, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Yet another version, passing one parameter that is a pointer */
|
/* Yet another version, passing one parameter that is a pointer */
|
||||||
|
|
@ -729,7 +729,7 @@ int RecurseCellFileHashTable(int (*foo)(struct hashlist *, int), int value)
|
||||||
struct nlist *RecurseCellHashTable2(struct nlist *(*foo)(struct hashlist *,
|
struct nlist *RecurseCellHashTable2(struct nlist *(*foo)(struct hashlist *,
|
||||||
void *), void *pointer)
|
void *), void *pointer)
|
||||||
{
|
{
|
||||||
return RecurseHashTablePointer(&cell_dict, foo, pointer);
|
return RecurseHashTablePointer(&cell_dict, foo, pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************** WILD-CARD STUFF *******************************/
|
/************************** WILD-CARD STUFF *******************************/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue