Additional changes, almost all stylistic, to make the resis/ section

style conform to the rest of the database.  It is difficult to work
with code written in a sloppy, random style.
This commit is contained in:
Tim Edwards 2021-05-26 22:34:36 -04:00
parent 9aa39f820f
commit 7f11020ab4
11 changed files with 919 additions and 945 deletions

View File

@ -1 +1 @@
8.3.169
8.3.170

View File

@ -72,7 +72,7 @@ ResSanityChecks(nodename,resistorList,nodeList,devlist)
resistor->rr_status &= ~RES_REACHED_RESISTOR;
}
/* Check 1- Are the resistors and nodes all connected? */
/* Check: Are the resistors and nodes all connected? */
while (!StackEmpty(resSanityStack))
{
node = (resNode *)STACKPOP(resSanityStack);
@ -86,7 +86,8 @@ ResSanityChecks(nodename,resistorList,nodeList,devlist)
if (resistor->rr_connection1 != node &&
resistor->rr_connection2 != node)
{
TxError("Stray resElement pointer- node %s, pointer %d\n",nodename,rcell);
TxError("Stray resElement pointer- node %s, pointer %d\n",
nodename, rcell);
continue;
}
if ((resistor->rr_connection1->rn_status & RES_REACHED_NODE) == 0)
@ -137,7 +138,8 @@ ResSanityChecks(nodename,resistorList,nodeList,devlist)
{
if ((node->rn_status & RES_REACHED_NODE) == 0)
{
TxError("Unreached node in %s at %d, %d\n",nodename,node->rn_loc.p_x,node->rn_loc.p_y);
TxError("Unreached node in %s at %d, %d\n", nodename,
node->rn_loc.p_x, node->rn_loc.p_y);
}
node->rn_status &= ~RES_REACHED_NODE;
if (node->rn_why & RES_NODE_ORIGIN)

View File

@ -65,7 +65,6 @@ int
dbcConnectFuncDCS(tile, cx)
Tile *tile;
TreeContext *cx;
{
struct conSrArg2 *csa2;
Rect tileArea, *srArea, devArea, newarea;
@ -104,13 +103,14 @@ dbcConnectFuncDCS(tile, cx)
{
TiToRect(tp, &devArea);
thisDev = (ResDevTile *) mallocMagic((unsigned)(sizeof(ResDevTile)));
ResCalcPerimOverlap(thisDev,tp);
GeoTransRect(&scx->scx_trans, &devArea, &thisDev->area);
thisDev->type = TiGetType(tp);
thisDev->nextDev = DevList;
DevList = thisDev;
ResCalcPerimOverlap(thisDev, tp);
}
}
/* right */
for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp=LB(tp))
{
@ -128,6 +128,7 @@ dbcConnectFuncDCS(tile, cx)
ResCalcPerimOverlap(thisDev, tp);
}
}
/* top */
for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp = BL(tp))
{
@ -145,6 +146,7 @@ dbcConnectFuncDCS(tile, cx)
ResCalcPerimOverlap(thisDev, tp);
}
}
/* bottom */
for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp = TR(tp))
{
@ -173,9 +175,10 @@ dbcConnectFuncDCS(tile, cx)
thisDev->nextDev = DevList;
DevList = thisDev;
}
/* in some cases (primarily bipolar technology), we'll want to extract
devices whose substrate terminals are part of the given region.
The following does that check. (10-11-88)
* devices whose substrate terminals are part of the given region.
* The following does that check. (10-11-88)
*/
#ifdef ARIEL
if (TTMaskHasType(&ResSubsTypeBitMask,t1) && (ResOptionsFlags & ResOpt_DoSubstrate))
@ -186,7 +189,7 @@ dbcConnectFuncDCS(tile, cx)
{
if (TTMaskIntersect(&DBPlaneTypes[pNum], mask))
{
(void)DBSrPaintArea((Tile *) NULL,
DBSrPaintArea((Tile *) NULL,
scx->scx_use->cu_def->cd_planes[pNum],
&tileArea, mask, resSubSearchFunc, (ClientData)cx);
}
@ -248,7 +251,6 @@ dbcConnectFuncDCS(tile, cx)
DBTreeSrLabels(&scx2, connectMask, csa2->csa2_xMask, &tpath,
TF_LABEL_ATTACH, dbcConnectLabelFunc,
(ClientData)csa2);
// DBCellCopyLabels(&scx2, connectMask, csa2->csa2_xMask, csa2->csa2_use, NULL);
/* Only extend those sides bordering the diagonal tile */
@ -322,7 +324,6 @@ void
ResCalcPerimOverlap(dev, tile)
ResDevTile *dev;
Tile *tile;
{
Tile *tp;
int t1;
@ -332,45 +333,34 @@ ResCalcPerimOverlap(dev, tile)
overlap =0;
t1 = TiGetType(tile);
/* left */
for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp))
{
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), TiGetType(tp))
{
overlap += MIN(TOP(tile), TOP(tp)) -
MAX(BOTTOM(tile), BOTTOM(tp));
}
}
/* right */
for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp=LB(tp))
{
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), TiGetType(tp))
{
overlap += MIN(TOP(tile),TOP(tp))-
MAX(BOTTOM(tile),BOTTOM(tp));
overlap += MIN(TOP(tile), TOP(tp)) - MAX(BOTTOM(tile), BOTTOM(tp));
}
}
/* top */
for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp = BL(tp))
{
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), TiGetType(tp))
{
overlap += MIN(RIGHT(tile),RIGHT(tp))-
MAX(LEFT(tile),LEFT(tp));
overlap += MIN(RIGHT(tile), RIGHT(tp)) - MAX(LEFT(tile), LEFT(tp));
}
}
/* bottom */
for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp=TR(tp))
{
if TTMaskHasType(&(ExtCurStyle->exts_nodeConn[t1]), TiGetType(tp))
{
overlap += MIN(RIGHT(tile),RIGHT(tp))-
MAX(LEFT(tile),LEFT(tp));
}
overlap += MIN(RIGHT(tile), RIGHT(tp)) - MAX(LEFT(tile), LEFT(tp));
}
dev->overlap = overlap;
}
@ -519,8 +509,6 @@ int
resSubSearchFunc(tile, cx)
Tile *tile;
TreeContext *cx;
{
ResDevTile *thisDev;
Rect devArea;
@ -528,10 +516,10 @@ resSubSearchFunc(tile,cx)
ExtDevice *devptr;
/* Right now, we're only going to extract substrate terminals for
devices with only one diffusion terminal, principally bipolar
devices.
* devices with only one diffusion terminal, principally bipolar
* devices.
*/
devptr = ExtCurStyle->exts_device[t]
devptr = ExtCurStyle->exts_device[t];
if (devptr->exts_deviceSDCount > 1) return 0;
TiToRect(tile, &devArea);
thisDev = (ResDevTile *) mallocMagic((unsigned)(sizeof(ResDevTile)));

View File

@ -49,7 +49,6 @@ void
ResPrintNodeList(fp, list)
FILE *fp;
resNode *list;
{
for (; list != NULL; list = list->rn_more)

View File

@ -105,7 +105,6 @@ enumerate:
resTopTile=BL(resTopTile);
}
}
}
tpnew = TR(resSrTile);
@ -134,7 +133,8 @@ enumerate:
}
/* At left edge -- walk down to next tile along the left edge */
for (resSrTile = LB(resSrTile); RIGHT(resSrTile) <= rect->r_xbot; resSrTile = TR(resSrTile))
for (resSrTile = LB(resSrTile); RIGHT(resSrTile) <= rect->r_xbot;
resSrTile = TR(resSrTile))
/* Nothing */;
}
return (0);
@ -164,11 +164,13 @@ ResCheckConcavity(bot,top,tt)
{
Tile *tp;
int xlen, ylen;
/* corner #1:
XXXXXXX
YYYYYYY
^--here
* XXXXXXX
* YYYYYYY
* ^--here
*/
if (RIGHT(top) > RIGHT(bot) && TiGetType(TR(bot)) != tt)
{
int xpos = RIGHT(bot);
@ -181,11 +183,13 @@ ResCheckConcavity(bot,top,tt)
}
}
if (resTopTile == NULL) return;
/* corner #2:
v--here
XXXXXXX
YYYYYYY
* v--here
* XXXXXXX
* YYYYYYY
*/
if (RIGHT(top) < RIGHT(bot))
{
for (tp = TR(top); BOTTOM(tp) > BOTTOM(top); tp = LB(tp));
@ -202,11 +206,13 @@ ResCheckConcavity(bot,top,tt)
}
}
if (resTopTile == NULL) return;
/* corner #3:
XXXXXXX
YYYYYYY
^--here
* XXXXXXX
* YYYYYYY
* ^--here
*/
if (LEFT(top) < LEFT(bot))
{
for (tp = BL(bot); TOP(tp) < TOP(bot); tp = RT(tp));
@ -223,11 +229,13 @@ ResCheckConcavity(bot,top,tt)
}
}
if (resTopTile == NULL) return;
/* corner #4:
v--here
XXXXXXX
YYYYYYY
* v--here
* XXXXXXX
* YYYYYYY
*/
if (LEFT(top) > LEFT(bot) && TiGetType(BL(top)) != tt)
{
int xpos = LEFT(top);
@ -419,6 +427,7 @@ resWalkleft(tile,tt,xpos,ypos,func)
*
*-------------------------------------------------------------------------
*/
Tile *
ResSplitX(tile, x)
Tile *tile;

View File

@ -26,8 +26,6 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "textio/txcommands.h"
#include "resis/resis.h"
/*
*-------------------------------------------------------------------------
*
@ -152,10 +150,10 @@ ResProcessJunction(tile, tp, xj, yj, NodeList)
junction->rj_nextjunction[1] = j2->junctionList;
j2->junctionList = junction;
NEWBREAK(junction->rj_jnode,tile,
junction->rj_loc.p_x,junction->rj_loc.p_y,NULL);
NEWBREAK(junction->rj_jnode,tile, junction->rj_loc.p_x,
junction->rj_loc.p_y, NULL);
NEWBREAK(junction->rj_jnode,tp,
junction->rj_loc.p_x,junction->rj_loc.p_y,NULL);
NEWBREAK(junction->rj_jnode,tp, junction->rj_loc.p_x,
junction->rj_loc.p_y, NULL);
}

View File

@ -574,18 +574,18 @@ ResProcessTiles(goodies, origin)
*/
bool
ResExtractNet(startlist, goodies, cellname)
ResFixPoint *startlist;
ResExtractNet(fix, goodies, cellname)
ResFixPoint *fix;
ResGlobalParams *goodies;
char *cellname;
{
SearchContext scx;
int pNum;
ResDevTile *DevTiles, *lasttile;
ResDevTile *DevTiles;
TileTypeBitMask FirstTileMask;
Point startpoint;
ResFixPoint *fix;
static int first = 1;
ResDevTile *newdevtiles, *tmp;
/* Make sure all global network variables are reset */
@ -601,7 +601,7 @@ ResExtractNet(startlist, goodies, cellname)
goodies->rg_maxres = 0;
goodies->rg_tilecount = 0;
/*set up internal stuff if this is the first time through */
/* Set up internal stuff if this is the first time through */
if (first)
{
@ -640,10 +640,6 @@ ResExtractNet(startlist, goodies, cellname)
/* Copy Paint */
DevTiles = NULL;
lasttile = NULL;
for (fix = startlist; fix != NULL; fix = fix->fp_next)
{
ResDevTile *newdevtiles, *tmp;
#ifdef ARIEL
if ((ResOptionsFlags & ResOpt_Power) &&
@ -663,20 +659,9 @@ ResExtractNet(startlist, goodies, cellname)
TTMaskZero(&FirstTileMask);
TTMaskSetMask(&FirstTileMask, &DBConnectTbl[fix->fp_ttype]);
newdevtiles = DBTreeCopyConnectDCS(&scx, &FirstTileMask, 0,
DevTiles = DBTreeCopyConnectDCS(&scx, &FirstTileMask, 0,
ResCopyMask, &TiPlaneRect, ResUse);
for (tmp = newdevtiles; tmp && tmp->nextDev; tmp = tmp->nextDev);
if (newdevtiles)
{
if (DevTiles)
lasttile->nextDev = newdevtiles;
else
DevTiles = newdevtiles;
lasttile = tmp;
}
}
ExtResetTiles(scx.scx_use->cu_def, extUnInit);
/* Find all contacts in design and note their position */

View File

@ -53,7 +53,8 @@ extern ResSimNode *ResOriginalNodes; /*Linked List of Nodes */
int resNodeNum;
#ifdef LAPLACE
int ResOptionsFlags = ResOpt_Simplify|ResOpt_Tdi|ResOpt_DoExtFile|ResOpt_CacheLaplace;
int ResOptionsFlags = ResOpt_Simplify | ResOpt_Tdi | ResOpt_DoExtFile
| ResOpt_CacheLaplace;
#else
int ResOptionsFlags = ResOpt_Simplify | ResOpt_Tdi | ResOpt_DoExtFile;
#endif
@ -480,7 +481,8 @@ typedef enum {
oldoptions = ResOptionsFlags;
ResOptionsFlags = ResOpt_DoSubstrate | ResOpt_Signal | ResOpt_Box;
#ifdef LAPLACE
ResOptionsFlags |= (oldoptions & (ResOpt_CacheLaplace|ResOpt_DoLaplace));
ResOptionsFlags |= (oldoptions &
(ResOpt_CacheLaplace | ResOpt_DoLaplace));
LaplaceMatchCount = 0;
LaplaceMissCount = 0;
#endif
@ -610,8 +612,6 @@ resSubcircuitFunc(cellDef, rdata)
return 0;
}
/*
*-------------------------------------------------------------------------
*
@ -1071,8 +1071,8 @@ ResCheckSimNodes(celldef, resisdata)
fp.fp_next = NULL;
if (ResExtractNet(&fp, &gparams, outfile) != 0)
{
/* On error, don't output this net, but keep going */
TxError("Error in extracting node %s\n", node->name);
// break; // Don't stop for one error. . .
}
else
{
@ -1429,7 +1429,8 @@ ResSortByGate(DevpointerList)
{
int changed = TRUE;
int localchange = TRUE;
devPtr *working, *last=NULL, *current, *gatelist=NULL;
devPtr *working, *current;
devPtr *last = NULL, *gatelist = NULL;
working = *DevpointerList;
while (working != NULL)

View File

@ -111,7 +111,7 @@ ResEach(tile, pNum, arg)
if (((ResContactPoint *)(arg->fra_region))->cp_contactTile != tile)
{
(void) ResFirst(tile, arg);
ResFirst(tile, arg);
}
return(0);
}
@ -137,7 +137,6 @@ int
ResAddPlumbing(tile, arg)
Tile *tile;
ClientData *arg;
{
tileJunk *Junk, *junk2;
static Stack *resDevStack = NULL;
@ -273,7 +272,7 @@ ResAddPlumbing(tile, arg)
if (source != (Tile *) NULL)
{
STACKPUSH((ClientData) (source),resDevStack);
STACKPUSH((ClientData)source, resDevStack);
}
while (!StackEmpty(resDevStack))
{
@ -308,7 +307,7 @@ ResAddPlumbing(tile, arg)
if ((j->tj_status & RES_TILE_SD) == 0)
{
j->tj_status |= RES_TILE_SD;
STACKPUSH((ClientData) (tp2),resDevStack);
STACKPUSH((ClientData)tp2, resDevStack);
}
}
}
@ -321,7 +320,7 @@ ResAddPlumbing(tile, arg)
if ((j->tj_status & RES_TILE_SD) == 0)
{
j->tj_status |= RES_TILE_SD;
STACKPUSH((ClientData) (tp2),resDevStack);
STACKPUSH((ClientData)tp2, resDevStack);
}
}
}
@ -334,7 +333,7 @@ ResAddPlumbing(tile, arg)
if ((j->tj_status & RES_TILE_SD) == 0)
{
j->tj_status |= RES_TILE_SD;
STACKPUSH((ClientData) (tp2),resDevStack);
STACKPUSH((ClientData)tp2, resDevStack);
}
}
}
@ -342,7 +341,7 @@ ResAddPlumbing(tile, arg)
/* find rest of device; search for source edges */
STACKPUSH((ClientData) (tile), resDevStack);
STACKPUSH((ClientData)tile, resDevStack);
while (!StackEmpty(resDevStack))
{
tileJunk *j0;
@ -365,7 +364,7 @@ ResAddPlumbing(tile, arg)
(tp2->ti_client == (ClientData) CLIENTDEFAULT))
{
Junk = resAddField(tp2);
STACKPUSH((ClientData)(tp2),resDevStack);
STACKPUSH((ClientData)tp2, resDevStack);
Junk->deviceList = resDev;
Junk->tj_status |= RES_TILE_DEV;
@ -385,7 +384,7 @@ ResAddPlumbing(tile, arg)
(tp2->ti_client == (ClientData) CLIENTDEFAULT))
{
Junk = resAddField(tp2);
STACKPUSH((ClientData)(tp2),resDevStack);
STACKPUSH((ClientData)tp2, resDevStack);
Junk->deviceList = resDev;
Junk->tj_status |= RES_TILE_DEV;
}
@ -404,7 +403,7 @@ ResAddPlumbing(tile, arg)
(tp2->ti_client == (ClientData) CLIENTDEFAULT))
{
Junk = resAddField(tp2);
STACKPUSH((ClientData)(tp2),resDevStack);
STACKPUSH((ClientData)tp2, resDevStack);
Junk->deviceList = resDev;
Junk->tj_status |= RES_TILE_DEV;
}
@ -423,7 +422,7 @@ ResAddPlumbing(tile, arg)
(tp2->ti_client == (ClientData) CLIENTDEFAULT))
{
Junk = resAddField(tp2);
STACKPUSH((ClientData)(tp2),resDevStack);
STACKPUSH((ClientData)tp2, resDevStack);
Junk->deviceList = resDev;
Junk->tj_status |= RES_TILE_DEV;
}
@ -443,7 +442,7 @@ ResAddPlumbing(tile, arg)
{
tileJunk *j = (tileJunk *) source->ti_client;
STACKPUSH((ClientData) (source),resDevStack);
STACKPUSH((ClientData)source, resDevStack);
j->tj_status &= ~RES_TILE_SD;
}
while (!StackEmpty(resDevStack))
@ -666,18 +665,17 @@ ResPreProcessDevices(TileList, DeviceList, Def)
*
*-------------------------------------------------------------------------
*/
void
ResAddToQueue(node, list)
resNode *node, **list;
{
node->rn_more = *list;
node->rn_less = NULL;
if (*list) (*list)->rn_less = node;
*list = node;
}
/*
*-------------------------------------------------------------------------
*
@ -694,9 +692,7 @@ ResAddToQueue(node,list)
void
ResRemoveFromQueue(node, list)
resNode *node, **list;
{
if (node->rn_less != NULL)
{
node->rn_less->rn_more = node->rn_more;
@ -719,10 +715,10 @@ ResRemoveFromQueue(node,list)
node->rn_more = NULL;
node->rn_less = NULL;
}
tileJunk *
resAddField(tile)
Tile *tile;
{
tileJunk *Junk;
if ((Junk = (tileJunk *)tile->ti_client) == (tileJunk *) CLIENTDEFAULT)

View File

@ -48,7 +48,6 @@ ResPrintNetwork(filename, reslist)
{
char bigname[255], name1[255], name2[255];
FILE *fp;
int i = 1;
@ -118,7 +117,6 @@ ResPrintCurrents(filename,extension,node)
}
/*
*-------------------------------------------------------------------------
*
@ -151,7 +149,6 @@ resCurrentPrintFunc(node,resistor,filename)
if (node->rn_why == RES_NODE_ORIGIN)
{
fprintf(filename, "i gnd %f\n", i_sum);
}
else
{
@ -159,7 +156,6 @@ resCurrentPrintFunc(node,resistor,filename)
node->rn_loc.p_y, i_sum);
}
}
}
void
@ -218,9 +214,9 @@ ResWriteECLFile(filename,reslist,nodelist)
}
for (; reslist; reslist = reslist->rr_nextResistor)
{
fprintf(fp, "r %s %s %f %s %d\n",
reslist->rr_node[0]->rn_name,reslist->rr_node[1]->rn_name,
reslist->rr_node[0]->rn_name,
reslist->rr_node[1]->rn_name,
/* /1000.0 gets ohms from milliohms */
(float)(reslist->rr_value) / 1000.0,
DBTypeShortName(reslist->rr_tt), reslist->rr_csArea);