diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index c9dc9cce..f855e3cc 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -3,7 +3,7 @@ on: tags: - "*" -name: CI +name: CI-appimage jobs: build_appimage: @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Get the version id: get_version run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bb6c1b93..50ae1261 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,7 +26,7 @@ jobs: simple_build_linux: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Get Dependencies run: | sudo apt-get install -y tcl-dev tk-dev libcairo-dev @@ -38,7 +38,7 @@ jobs: simple_build_wasm: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Get Dependencies run: | git clone https://github.com/emscripten-core/emsdk.git @@ -48,10 +48,10 @@ jobs: - name: Build run: | source ./emsdk/emsdk_env.sh - emconfigure ./configure --without-cairo --without-opengl --without-x --disable-readline --target=asmjs-unknown-emscripten + emconfigure ./configure --without-cairo --without-opengl --without-x --disable-readline --disable-compression --target=asmjs-unknown-emscripten emmake make - name: archive wasm bundle - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: magic-wasm-bundle path: | @@ -59,7 +59,7 @@ jobs: # simple_build_mac: # runs-on: macos-11 # steps: - # - uses: actions/checkout@v2 + # - uses: actions/checkout@v4 # - name: Get Dependencies # run: | # brew install --cask xquartz diff --git a/INSTALL b/INSTALL index 0543faba..a80553fc 100644 --- a/INSTALL +++ b/INSTALL @@ -47,6 +47,12 @@ Autoconf Capsule Summary: Disable threaded X11 and OpenGL graphics. Normally enabled. + --disable-compression + Disable reading and writing of compressed + (gzipped) GDS files and reading of compressed + .mag files. Normally enabled, if the zlib + development package is installed. + Notes to Magic maintainers: -------------------------- diff --git a/VERSION b/VERSION index 97d9b26a..8b3ac721 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.483 +8.3.496 diff --git a/appimage/Dockerfile b/appimage/Dockerfile index ec683035..2242360f 100644 --- a/appimage/Dockerfile +++ b/appimage/Dockerfile @@ -2,6 +2,17 @@ FROM centos/python-38-centos7:20210726-fad62e9 USER root +# CentOS7 went EOL on June 30, 2024 this builds out of vault.centos.org +RUN ls -l /etc/yum.repos.d/ \ + && cp /etc/yum.repos.d/CentOS-Base.repo /tmp/CentOS-Base.repo.old \ + && sed -e 's/mirror.centos.org/vault.centos.org/g' -i /etc/yum.repos.d/*.repo \ + && sed -e 's/^#.*baseurl=http/baseurl=http/g' -i /etc/yum.repos.d/*.repo \ + && sed -e 's/^mirrorlist=http/#mirrorlist=http/g' -i /etc/yum.repos.d/*.repo \ + && diff -u /tmp/CentOS-Base.repo.old /etc/yum.repos.d/CentOS-Base.repo; \ + yum clean all \ + && yum -y update \ + && rm -f /tmp/CentOS-Base.repo.old + # Build Dependencies RUN yum install -y cairo-devel freeglut-devel gcc make tcsh diff --git a/bplane/bpBins.c b/bplane/bpBins.c index 54f355a9..141cd886 100644 --- a/bplane/bpBins.c +++ b/bplane/bpBins.c @@ -569,7 +569,7 @@ BinArray *bpBinArrayBuild(Rect bbox, /* Added by Tim, 2/19/2024 */ /* This line is not supposed to be needed? */ - if ((!subbin) && ((int)elements & BT_ARRAY)) return NULL; + if ((!subbin) && ((pointertype)elements & BT_ARRAY)) return NULL; if(BPD) DumpRect("#### bpBinArrayBuild, TOP bbox= ", &bbox); diff --git a/bplane/bpEnum.h b/bplane/bpEnum.h index 5cb7fbfa..1d44a5df 100644 --- a/bplane/bpEnum.h +++ b/bplane/bpEnum.h @@ -506,23 +506,23 @@ static __inline__ void *BPEnumNext(BPEnum *bpe) switch (bpe->bpe_top->bps_state) { case BPS_BINS: - if(e=bpEnumNextBINS(bpe, 0)) return e; + if((e=bpEnumNextBINS(bpe, 0))) return e; break; case BPS_BINS_INSIDE: - if(e=bpEnumNextBINS(bpe, 1)) return e; + if((e=bpEnumNextBINS(bpe, 1))) return e; break; case BPS_INBOX: - if(e=bpEnumNextINBOX(bpe, 0)) return e; + if((e=bpEnumNextINBOX(bpe, 0))) return e; break; case BPS_INBOX_INSIDE: - if(e=bpEnumNextINBOX(bpe, 1)) return e; + if((e=bpEnumNextINBOX(bpe, 1))) return e; break; case BPS_HASH: - if(e=bpEnumNextHASH(bpe)) return e; + if((e=bpEnumNextHASH(bpe))) return e; break; case BPS_DONE: diff --git a/bplane/bpMain.c b/bplane/bpMain.c index b3cd752d..36046973 100644 --- a/bplane/bpMain.c +++ b/bplane/bpMain.c @@ -262,7 +262,7 @@ Rect BPBBox(BPlane *bp) e = BPEnumNext(&bpe); bp->bp_bbox = e->e_rect; - while(e = BPEnumNext(&bpe)) + while((e = BPEnumNext(&bpe))) { GeoIncludeRectInBBox(&e->e_rect, &bp->bp_bbox); } diff --git a/calma/CalmaRdcl.c b/calma/CalmaRdcl.c index ab93664b..c5e014b0 100644 --- a/calma/CalmaRdcl.c +++ b/calma/CalmaRdcl.c @@ -351,7 +351,7 @@ calmaParseStructure(filename) char *filename; /* Name of the GDS file read */ { static int structs[] = { CALMA_STRCLASS, CALMA_STRTYPE, -1 }; - int nbytes, rtype, nsrefs, osrefs, npaths; + int nbytes = -1, rtype = 0, nsrefs, osrefs, npaths; char *strname = NULL; HashEntry *he; int timestampval = 0; diff --git a/calma/CalmaRdio.c b/calma/CalmaRdio.c index f51d5dd3..c6d07661 100644 --- a/calma/CalmaRdio.c +++ b/calma/CalmaRdio.c @@ -434,7 +434,7 @@ calmaReadR8(pd) /* Extract the sign and exponent */ exponent = dchars[0]; - if (isneg = (exponent & 0x80)) + if ((isneg = (exponent & 0x80))) exponent &= ~0x80; exponent -= 64; diff --git a/calma/CalmaRdpt.c b/calma/CalmaRdpt.c index 92bd9ef3..0b4cf92d 100644 --- a/calma/CalmaRdpt.c +++ b/calma/CalmaRdpt.c @@ -267,7 +267,7 @@ calmaElementBoundary() he = HashFind(&calmaDefInitHash, newname); if (!HashGetValue(he)) { - newdef = calmaFindCell(newname, NULL); + newdef = calmaFindCell(newname, NULL, NULL); cifReadCellDef = newdef; DBCellClearDef(cifReadCellDef); DBCellSetAvail(cifReadCellDef); @@ -503,7 +503,7 @@ calmaElementBox() void calmaElementPath() { - int nbytes, rtype, extend1, extend2; + int nbytes = -1, rtype = 0, extend1, extend2; int layer, dt, width, pathtype, ciftype, savescale; int xmin, ymin, xmax, ymax, temp; CIFPath *pathheadp, *pathp, *previousp; @@ -673,7 +673,7 @@ calmaElementPath() he = HashFind(&calmaDefInitHash, newname); if (!HashGetValue(he)) { - newdef = calmaFindCell(newname, NULL); + newdef = calmaFindCell(newname, NULL, NULL); cifReadCellDef = newdef; DBCellClearDef(cifReadCellDef); DBCellSetAvail(cifReadCellDef); @@ -733,7 +733,7 @@ calmaElementText() { static int ignore[] = { CALMA_PATHTYPE, CALMA_WIDTH, -1 }; char *textbody = NULL; - int nbytes, rtype; + int nbytes = -1, rtype = 0; int layer, textt, cifnum, textpres; TileType type; Rect r; diff --git a/calma/CalmaRead.c b/calma/CalmaRead.c index d8db3fdf..04919c02 100644 --- a/calma/CalmaRead.c +++ b/calma/CalmaRead.c @@ -172,7 +172,7 @@ CalmaReadFile(file, filename) char *filename; /* The real name of the file read */ { int k, version; - char *libname = NULL, *libnameptr; + char *libname = NULL, *libnameptr = NULL; MagWindow *mw; static int hdrSkip[] = { CALMA_FORMAT, CALMA_MASK, CALMA_ENDMASKS, CALMA_REFLIBS, CALMA_FONTS, CALMA_ATTRTABLE, @@ -309,7 +309,11 @@ done: HashKill(&calmaDefInitHash); UndoEnable(); - if (calmaErrorFile != NULL) fclose(calmaErrorFile); + if (calmaErrorFile != NULL) + { + fclose(calmaErrorFile); + calmaErrorFile = NULL; + } } /* @@ -345,7 +349,7 @@ done: bool calmaParseUnits() { - int nbytes, rtype; + int nbytes, rtype = 0; double metersPerDBUnit; double userUnitsPerDBUnit; double cuPerDBUnit; diff --git a/calma/CalmaWrite.c b/calma/CalmaWrite.c index a9bb6fe2..6809b98d 100644 --- a/calma/CalmaWrite.c +++ b/calma/CalmaWrite.c @@ -24,6 +24,7 @@ static char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic-8.0/c #include #include /* for random() */ #include +#include #include #include #include /* for htons() */ @@ -393,7 +394,7 @@ CalmaWrite(rootDef, f) good = !ferror(f); /* See if any problems occurred */ - if (problems = (DBWFeedbackCount - oldCount)) + if ((problems = (DBWFeedbackCount - oldCount))) TxPrintf("%d problems occurred. See feedback entries.\n", problems); /* @@ -429,7 +430,7 @@ calmaDumpStructure(def, outf, calmaDefHash, filename) HashTable *calmaDefHash; char *filename; { - int nbytes, rtype; + int nbytes = -1, rtype = 0; char *strname = NULL, *newnameptr; HashEntry *he, *he2; CellDef *edef; @@ -1440,7 +1441,7 @@ calmaOutFunc(def, f, cliprect) numports++; } } - if (newll != NULL) + if (ll != NULL) { /* Turn linked list into an array, then run qsort on it */ /* to sort by port number. */ @@ -1769,7 +1770,7 @@ calmaOutStructName(type, def, f) } /* Is the def name a legal Calma name? */ - for (cp = def->cd_name; c = (unsigned char) *cp; cp++) + for (cp = def->cd_name; (c = (unsigned char) *cp); cp++) { if ((c > 127) || (table[c] == 0)) goto bad; diff --git a/calma/CalmaWriteZ.c b/calma/CalmaWriteZ.c index 16e717df..80d0dbdb 100644 --- a/calma/CalmaWriteZ.c +++ b/calma/CalmaWriteZ.c @@ -34,6 +34,7 @@ static char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic-8.0/c #include #include /* for random() */ #include +#include #include #include #include /* for htons() */ @@ -369,7 +370,7 @@ CalmaWriteZ(rootDef, f) good = (nerr == 0) ? TRUE : FALSE; /* See if any problems occurred */ - if (problems = (DBWFeedbackCount - oldCount)) + if ((problems = (DBWFeedbackCount - oldCount))) TxPrintf("%d problems occurred. See feedback entries.\n", problems); /* @@ -405,7 +406,7 @@ calmaDumpStructureZ(def, outf, calmaDefHash, filename) HashTable *calmaDefHash; char *filename; { - int nbytes, rtype; + int nbytes = -1, rtype = 0; char *strname = NULL, *newnameptr; HashEntry *he, *he2; CellDef *edef; @@ -1605,7 +1606,7 @@ calmaOutStructNameZ(type, def, f) } /* Is the def name a legal Calma name? */ - for (cp = def->cd_name; c = (unsigned char) *cp; cp++) + for (cp = def->cd_name; (c = (unsigned char) *cp); cp++) { if ((c > 127) || (table[c] == 0)) goto bad; diff --git a/cif/CIFgen.c b/cif/CIFgen.c index 1591088c..bc234dc5 100644 --- a/cif/CIFgen.c +++ b/cif/CIFgen.c @@ -1379,8 +1379,24 @@ cifBloatAllFunc(tile, bls) area.r_xtop *= locScale; area.r_ytop *= locScale; - DBNMPaintPlane(cifPlane, TiGetTypeExact(t), &area, - CIFPaintTable, (PaintUndoInfo *) NULL); + /* Diagonal: If expanding across the edge of a diagonal, */ + /* then just fill the whole tile. */ + + if (IsSplit(t)) + { + TileType tt; + tt = TiGetTypeExact(t); + if ((tt & TT_SIDE) && (TTMaskHasType(connect, TiGetLeftType(t)))) + DBPaintPlane(cifPlane, &area, CIFPaintTable, (PaintUndoInfo *) NULL); + else if (!(tt & TT_SIDE) && (TTMaskHasType(connect, TiGetRightType(t)))) + DBPaintPlane(cifPlane, &area, CIFPaintTable, (PaintUndoInfo *) NULL); + else + DBNMPaintPlane(cifPlane, TiGetTypeExact(t), &area, + CIFPaintTable, (PaintUndoInfo *) NULL); + } + else + DBNMPaintPlane(cifPlane, TiGetTypeExact(t), &area, + CIFPaintTable, (PaintUndoInfo *) NULL); /* Top */ for (tp = RT(t); RIGHT(tp) > LEFT(t); tp = BL(tp)) @@ -1401,6 +1417,7 @@ cifBloatAllFunc(tile, bls) for (tp = TR(t); TOP(tp) > BOTTOM(t); tp = LB(tp)) if (TTMaskHasType(connect, TiGetLeftType(tp))) PUSHTILE(tp, BloatStack); + } /* Clear the tiles that were processed */ @@ -4140,11 +4157,13 @@ bridgeErase(brlims, area) } for (t = 0; t < TT_MAXTYPES; t++, temps++) + { if (TTMaskHasType(&brlims->co_cifMask, t)) if (DBSrPaintArea((Tile *) NULL, *temps, area, &CIFSolidBits, cifPaintFunc, CIFEraseTable)) return 0; - - return 1; //Nothing found + } + + return 1; //Nothing found } /* @@ -4896,7 +4915,7 @@ CIFGenLayer(op, area, cellDef, origDef, temps, hier, clientdata) } netname = (char *)op->co_client; cifPlane = curPlane; - ttype = CmdFindNetProc(netname, CIFDummyUse, &bbox, FALSE); + ttype = CmdFindNetProc(netname, CIFDummyUse, &bbox, FALSE, NULL); if (ttype != TT_SPACE) { UndoDisable(); diff --git a/cif/CIFrdcl.c b/cif/CIFrdcl.c index 44ad78fb..7d859077 100644 --- a/cif/CIFrdcl.c +++ b/cif/CIFrdcl.c @@ -389,7 +389,7 @@ CIFInputRescale(n, d) CIFScalePlanes(n, d, cifCurReadPlanes); if (cifCurReadPlanes != cifEditCellPlanes) CIFScalePlanes(n, d, cifEditCellPlanes); - if (cifEditCellPlanes != cifSubcellPlanes && cifCurReadPlanes != cifSubcellPlanes) + if ((const Plane*)cifEditCellPlanes != (const Plane*)cifSubcellPlanes && cifCurReadPlanes != cifSubcellPlanes) CIFScalePlanes(n, d, cifSubcellPlanes); CIFReadWarning("CIF style %s: units rescaled by factor of %d / %d\n", diff --git a/cif/CIFrdtech.c b/cif/CIFrdtech.c index 70c6dc99..271ee1b3 100644 --- a/cif/CIFrdtech.c +++ b/cif/CIFrdtech.c @@ -206,24 +206,24 @@ CIFCalmaLayerToCifLayer(layer, datatype, calmaStyle) clt.clt_layer = layer; clt.clt_type = datatype; - if (he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt)) + if ((he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt))) return ((spointertype) HashGetValue(he)); /* Try wildcarding the datatype */ clt.clt_type = -1; - if (he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt)) + if ((he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt))) return ((spointertype) HashGetValue(he)); /* Try wildcarding the layer */ clt.clt_layer = -1; clt.clt_type = datatype; - if (he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt)) + if ((he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt))) return ((spointertype) HashGetValue(he)); /* Try wildcarding them both, for a default value */ clt.clt_layer = -1; clt.clt_type = -1; - if (he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt)) + if ((he = HashLookOnly(&(calmaStyle->cifCalmaToCif), (char *) &clt))) return ((spointertype) HashGetValue(he)); /* No luck */ diff --git a/cif/CIFrdutils.c b/cif/CIFrdutils.c index 53695ef5..5a46f71c 100644 --- a/cif/CIFrdutils.c +++ b/cif/CIFrdutils.c @@ -1253,7 +1253,7 @@ CIFCleanPath(pathHead) if (!path) return; } - while (next = path->cifp_next) + while ((next = path->cifp_next)) { if ((dir2 = CIFEdgeDirection(path, next)) == CIF_ZERO) { diff --git a/cmwind/CMWcmmnds.c b/cmwind/CMWcmmnds.c index 3cf3404e..b5aaf2dc 100644 --- a/cmwind/CMWcmmnds.c +++ b/cmwind/CMWcmmnds.c @@ -372,7 +372,7 @@ cmwColor(w, cmd) } else if (cmd->tx_argc == 2) { - if (sscanf(cmd->tx_argv[1], "%i", &color) == 0) + if (sscanf(cmd->tx_argv[1], "%i", &color) != 1) { /* Invalid color---allow keywords "next" and "last" */ crec = (CMWclientRec *) w->w_clientData; diff --git a/cmwind/CMWmain.c b/cmwind/CMWmain.c index 38a3040c..127b0ae4 100644 --- a/cmwind/CMWmain.c +++ b/cmwind/CMWmain.c @@ -91,36 +91,36 @@ extern void CMWundoInit(); ColorBar colorBars[] = { - "Red", CB_RED, STYLE_RED, {2000, 8000, 10000, 9000}, - {2000, 9500, 10000, 10500}, - "Green", CB_GREEN, STYLE_GREEN, {2000, 5000, 10000, 6000}, - {2000, 6500, 10000, 7500}, - "Blue", CB_BLUE, STYLE_BLUE, {2000, 2000, 10000, 3000}, - {2000, 3500, 10000, 4500}, - "Hue", CB_HUE, STYLE_YELLOW, {14000, 8000, 22000, 9000}, - {14000, 9500, 22000, 10500}, - "Saturation", CB_SAT, STYLE_GRAY, {14000, 5000, 22000, 6000}, - {14000, 6500, 22000, 7500}, - "Value", CB_VALUE, STYLE_BROWN1, {14000, 2000, 22000, 3000}, - {14000, 3500, 22000, 4500}, - 0 + {"Red", CB_RED, STYLE_RED, {{ 2000, 8000}, {10000, 9000}}, + {{ 2000, 9500}, {10000, 10500}}}, + {"Green", CB_GREEN, STYLE_GREEN, {{ 2000, 5000}, {10000, 6000}}, + {{ 2000, 6500}, {10000, 7500}}}, + {"Blue", CB_BLUE, STYLE_BLUE, {{ 2000, 2000}, {10000, 3000}}, + {{ 2000, 3500}, {10000, 4500}}}, + {"Hue", CB_HUE, STYLE_YELLOW, {{14000, 8000}, {22000, 9000}}, + {{14000, 9500}, {22000, 10500}}}, + {"Saturation", CB_SAT, STYLE_GRAY, {{14000, 5000}, {22000, 6000}}, + {{14000, 6500}, {22000, 7500}}}, + {"Value", CB_VALUE, STYLE_BROWN1, {{14000, 2000}, {22000, 3000}}, + {{14000, 3500}, {22000, 4500}}}, + {0} }; ColorPump colorPumps[] = { - CB_RED, -.0078, {500, 8000, 1500, 9000}, - CB_RED, .0078, {10500, 8000, 11500, 9000}, - CB_GREEN, -.0078, {500, 5000, 1500, 6000}, - CB_GREEN, .0078, {10500, 5000, 11500, 6000}, - CB_BLUE, -.0078, {500, 2000, 1500, 3000}, - CB_BLUE, .0078, {10500, 2000, 11500, 3000}, - CB_HUE, -.01, {12500, 8000, 13500, 9000}, - CB_HUE, .01, {22500, 8000, 23500, 9000}, - CB_SAT, -.01, {12500, 5000, 13500, 6000}, - CB_SAT, .01, {22500, 5000, 23500, 6000}, - CB_VALUE, -.01, {12500, 2000, 13500, 3000}, - CB_VALUE, .01, {22500, 2000, 23500, 3000}, - -1 + {CB_RED, -.0078, {{ 500, 8000}, { 1500, 9000}}}, + {CB_RED, .0078, {{10500, 8000}, {11500, 9000}}}, + {CB_GREEN, -.0078, {{ 500, 5000}, { 1500, 6000}}}, + {CB_GREEN, .0078, {{10500, 5000}, {11500, 6000}}}, + {CB_BLUE, -.0078, {{ 500, 2000}, { 1500, 3000}}}, + {CB_BLUE, .0078, {{10500, 2000}, {11500, 3000}}}, + {CB_HUE, -.01, {{12500, 8000}, {13500, 9000}}}, + {CB_HUE, .01, {{22500, 8000}, {23500, 9000}}}, + {CB_SAT, -.01, {{12500, 5000}, {13500, 6000}}}, + {CB_SAT, .01, {{22500, 5000}, {23500, 6000}}}, + {CB_VALUE, -.01, {{12500, 2000}, {13500, 3000}}}, + {CB_VALUE, .01, {{22500, 2000}, {23500, 3000}}}, + {-1} }; Rect cmwCurrentColorArea = {{6000, 12000}, {18000, 15000}}; diff --git a/commands/CmdCD.c b/commands/CmdCD.c index edd80361..77a083d0 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -23,6 +23,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include "tcltk/tclmagic.h" #include "utils/magic.h" @@ -3683,7 +3684,7 @@ CmdCrash(w, cmd) MagWindow *w; TxCommand *cmd; { - int option; + int option = -1; char *filename = NULL; static char *cmdCrashOpt[] = {"save", "recover", 0}; diff --git a/commands/CmdE.c b/commands/CmdE.c index 28f10edc..dab3ab70 100644 --- a/commands/CmdE.c +++ b/commands/CmdE.c @@ -201,7 +201,7 @@ cmdEditRedisplayFunc(w, area) MagWindow *w; /* Window containing edit cell. */ Rect *area; /* Area to be redisplayed. */ { - static Rect origin = {-1, -1, 1, 1}; + static Rect origin = {{-1, -1}, {1, 1}}; Rect tmp; DBWclientRec *crec = (DBWclientRec *) w->w_clientData; diff --git a/commands/CmdFI.c b/commands/CmdFI.c index cfd4066b..b1b437d0 100644 --- a/commands/CmdFI.c +++ b/commands/CmdFI.c @@ -1597,7 +1597,7 @@ CmdFindNetProc(nodename, use, rect, warn_not_found, isvalid) scx.scx_trans = GeoIdentityTransform; s = nodename; trans = GeoIdentityTransform; - while (s2 = strchr(s, '/')) + while ((s2 = strchr(s, '/'))) { *s2 = '\0'; DBTreeFindUse(s, scx.scx_use, &scx2); diff --git a/commands/CmdLQ.c b/commands/CmdLQ.c index 283d2381..3b3440cb 100644 --- a/commands/CmdLQ.c +++ b/commands/CmdLQ.c @@ -2324,8 +2324,9 @@ CmdDoProperty(def, cmd, argstart) if (locargc == 1) { /* print all properties and their values */ - DBPropEnum(def, printPropertiesFunc); + DBPropEnum(def, printPropertiesFunc, NULL); } + else if (locargc == 2) { /* print the value of the indicated property */ @@ -2342,7 +2343,7 @@ CmdDoProperty(def, cmd, argstart) /* just return NULL if the property was not found. */ if (strcmp(cmd->tx_argv[1], "list")) #endif - TxError("Property name %s is not defined\n"); + TxError("Property name \"%s\" is not defined\n", cmd->tx_argv[1]); } } else if (locargc == 3) diff --git a/commands/CmdRS.c b/commands/CmdRS.c index 9f06c33c..41a66744 100644 --- a/commands/CmdRS.c +++ b/commands/CmdRS.c @@ -23,6 +23,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include #include @@ -817,7 +818,7 @@ CmdSelect(w, cmd) * multiples types are pointed to, consecutive * selections will cycle through them. */ - static Rect lastArea = {-100, -100, -200, -200}; + static Rect lastArea = {{-100, -100}, {-200, -200}}; /* Used to remember region around what was * pointed at in the last select command: a * new selection in this area causes the next diff --git a/commands/CmdSubrs.c b/commands/CmdSubrs.c index c5cdf734..9932b6f9 100644 --- a/commands/CmdSubrs.c +++ b/commands/CmdSubrs.c @@ -399,18 +399,18 @@ CmdParseLayers(s, mask) } special[] = { - "$", LN_DOLLAR, - "*", LN_ALL, - "errors", LN_ERRORS, - "labels", LN_LABELS, - "subcell", LN_CELL, - "connect", LN_CONNECT, - 0, + {"$", LN_DOLLAR}, + {"*", LN_ALL}, + {"errors", LN_ERRORS}, + {"labels", LN_LABELS}, + {"subcell", LN_CELL}, + {"connect", LN_CONNECT}, + {0}, }; TTMaskZero(mask); - while (c = *s++) + while ((c = *s++)) { switch (c) { @@ -756,7 +756,7 @@ again: if (strcmp(returnname, def->cd_name) != 0) { - if (f = PaOpen(returnname, "r", DBSuffix, ".", (char *) NULL, &filename)) + if ((f = PaOpen(returnname, "r", DBSuffix, ".", (char *) NULL, &filename))) { (void) fclose(f); if (noninteractive) { diff --git a/commands/CmdTZ.c b/commands/CmdTZ.c index 60ec727b..8f8681ef 100644 --- a/commands/CmdTZ.c +++ b/commands/CmdTZ.c @@ -415,10 +415,12 @@ CmdTech(w, cmd) for (ctype = TT_TECHDEPBASE; ctype < DBNumUserLayers; ctype++) if (DBIsContact(ctype)) + { if (TTMaskHasType(&DBActiveLayerBits, ctype)) DBUnlockContact(ctype); else DBLockContact(ctype); + } for (ctype = DBNumUserLayers; ctype < DBNumTypes; ctype++) { @@ -981,7 +983,7 @@ CmdWhat(w, cmd) if (EditCellUse == NULL) { editNull = TRUE; - EditCellUse = w->w_surfaceID; + EditCellUse = (CellUse *)w->w_surfaceID; } /* Find all the selected paint and print out the layer names. */ diff --git a/commands/CmdWizard.c b/commands/CmdWizard.c index 06598a24..b66d8828 100644 --- a/commands/CmdWizard.c +++ b/commands/CmdWizard.c @@ -24,6 +24,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include #include #include @@ -976,7 +977,7 @@ cmdTsrFunc(tp) Tile *tp; { if (cmdTsearchDebug) - TxPrintf("%x\n", tp); + TxPrintf("%lx\n", (intmax_t) tp); numTilesFound++; return 0; } diff --git a/database/DBcell.c b/database/DBcell.c index 57444bae..a28d4493 100644 --- a/database/DBcell.c +++ b/database/DBcell.c @@ -106,7 +106,7 @@ DBCellFindDup(use, parent) BPEnumInit(&bpe, parent->cd_cellPlane, &use->cu_bbox, BPE_EQUAL, "DBCellFindDup"); - while (dupUse = BPEnumNext(&bpe)) + while ((dupUse = BPEnumNext(&bpe))) if (dupUse->cu_def == use->cu_def) /* Transforms must be equal---Aligned bounding boxes are * an insufficient measure of exact overlap. diff --git a/database/DBcellcopy.c b/database/DBcellcopy.c index ebfd15dd..3a173c6b 100644 --- a/database/DBcellcopy.c +++ b/database/DBcellcopy.c @@ -603,7 +603,7 @@ DBFlattenInPlace(use, dest, xMask, dolabels, toplabels, doclear) { int savemask = scx.scx_use->cu_expandMask; scx.scx_use->cu_expandMask = CU_DESCEND_SPECIAL; - DBCellCopyAllLabels(&scx, &DBAllTypeBits, CU_DESCEND_SPECIAL, dest); + DBCellCopyAllLabels(&scx, &DBAllTypeBits, CU_DESCEND_SPECIAL, dest, NULL); scx.scx_use->cu_expandMask = savemask; } @@ -666,7 +666,7 @@ DBFlattenInPlace(use, dest, xMask, dolabels, toplabels, doclear) scx.scx_y++; scx.scx_x = use->cu_xlo; } - else if (use->cu_yhi > use->cu_yhi) + else if (use->cu_ylo > use->cu_yhi) { scx.scx_y--; scx.scx_x = use->cu_xlo; @@ -1725,7 +1725,8 @@ DBCellCopyAllCells(scx, xMask, targetUse, pArea) /* dbCellCopyCellsFunc() allows cells to be left with duplicate IDs */ /* so generate unique IDs as needed now. */ - DBGenerateUniqueIds(targetUse->cu_def, FALSE); + + if (targetUse != NULL) DBGenerateUniqueIds(targetUse->cu_def, FALSE); } /* diff --git a/database/DBcellname.c b/database/DBcellname.c index 490c8942..faf10fc6 100644 --- a/database/DBcellname.c +++ b/database/DBcellname.c @@ -283,7 +283,7 @@ DBCellDelete(cellname, force) /* so that WindUnload() will create a new one. */ if (!strcmp(cellname, UNNAMED)) - DBCellRename(cellname, "__UNNAMED__"); + DBCellRename(cellname, "__UNNAMED__", FALSE); /* For all top-level cell uses, check if any windows have this */ /* use. If so, load the window with (UNNAMED). */ @@ -1121,11 +1121,13 @@ DBUsePrint(CellName, who, dolist) celldef = DBCellLookDef(CellName); *lasthier = '/'; } - else + else if (EditCellUse != NULL) { /* Referenced cellDef is the current edit def */ celldef = EditCellUse->cu_def; } + else + return; switch (who) { @@ -1601,7 +1603,7 @@ dbAbutmentUseFunc(selUse, use, transform, data) } trans = &use->cu_transform; - propvalue = DBPropGet(use->cu_def, "FIXED_BBOX", &found); + propvalue = (char *)DBPropGet(use->cu_def, "FIXED_BBOX", &found); if (!found) bbox = use->cu_def->cd_bbox; else @@ -1698,7 +1700,7 @@ DBCellNewDef(cellName) cellName = UNNAMED; entry = HashFind(&dbCellDefTable, cellName); - if (HashGetValue(entry) != (ClientData) NULL) + if (HashGetValue(entry) != NULL) return ((CellDef *) NULL); cellDef = DBCellDefAlloc(); @@ -1859,7 +1861,7 @@ DBCellRenameDef(cellDef, newName) ASSERT(HashGetValue(oldEntry) == (ClientData) cellDef, "DBCellRenameDef"); newEntry = HashFind(&dbCellDefTable, newName); - if (HashGetValue(newEntry) != (ClientData) NULL) + if (HashGetValue(newEntry) != NULL) return (FALSE); HashSetValue(oldEntry, (ClientData) NULL); @@ -2507,7 +2509,7 @@ DBUnLinkCell(use, parentDef) { HashEntry *he; - if (he = HashLookOnly(&parentDef->cd_idHash, use->cu_id)) + if ((he = HashLookOnly(&parentDef->cd_idHash, use->cu_id))) HashSetValue(he, (ClientData) NULL); } diff --git a/database/DBcellsrch.c b/database/DBcellsrch.c index c5a2e400..c4d91492 100644 --- a/database/DBcellsrch.c +++ b/database/DBcellsrch.c @@ -92,7 +92,7 @@ DBSrCellPlaneArea(BPlane *plane, Rect *rect, int (*func)(), ClientData arg) bpe = (BPEnum *)mallocMagic(sizeof(BPEnum)); BPEnumInit(bpe, plane, rect, BPE_OVERLAP, "DBSrCellPlaneArea"); - while (use = BPEnumNext(bpe)) + while ((use = BPEnumNext(bpe))) { if ((*func)(use, arg)) { @@ -1621,7 +1621,7 @@ dbTileScaleFunc(tile, scvals) if ((targetRect.r_xtop - targetRect.r_xbot == 0) || (targetRect.r_ytop - targetRect.r_ybot == 0)) { - TxPrintf("Tile 0x%x at (%d, %d) has zero area after scaling: Removed.\n", + TxPrintf("Tile %p at (%d, %d) has zero area after scaling: Removed.\n", tile, targetRect.r_xbot, targetRect.r_ybot); return 0; } @@ -2241,7 +2241,7 @@ DBMoveCell(cellDef, origx, origy) newplane = DBNewPlane((ClientData) TT_SPACE); DBClearPaintPlane(newplane); if (dbMovePlane(cellDef->cd_planes[pNum], newplane, pNum, - origx, origy, FALSE)) + origx, origy)) cellDef->cd_flags |= (CDMODIFIED | CDGETNEWSTAMP); DBFreePaintPlane(cellDef->cd_planes[pNum]); TiFreePlane(cellDef->cd_planes[pNum]); diff --git a/database/DBio.c b/database/DBio.c index 9635220f..e5c8c40b 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -28,6 +28,8 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include +#include #ifdef HAVE_DIRENT_H #include @@ -686,8 +688,8 @@ dbCellReadDef(f, cellDef, ignoreTech, dereference) freeMagic(argv[1]); freeMagic(argv[0]); } -#endif } +#endif } if (strcmp(DBTechName, tech)) { @@ -1070,7 +1072,7 @@ DBFileRecovery(filename) struct stat sbuf; uid_t userid = getuid(); time_t recent = 0; - char *snptr, *tempdir, tempname[256]; + char *snptr, *tempdir, tempname[1024]; int pid; static char *actionNames[] = {"read", "cancel", 0 }; char *prompt; @@ -1096,7 +1098,8 @@ DBFileRecovery(filename) while ((dp = readdir(cwd)) != NULL) { char *doslash = (tempdir[strlen(tempdir) - 1] == '/') ? "" : "/"; - sprintf(tempname, "%s%s%s", tempdir, doslash, dp->d_name); + int n = snprintf(tempname, sizeof(tempname), "%s%s%s", tempdir, doslash, dp->d_name); + ASSERT(n < sizeof(tempname), "tempname"); snptr = tempname + strlen(tempdir); if (!strncmp(snptr, "MAG", 3)) { @@ -1417,9 +1420,10 @@ dbReadOpen(cellDef, setFileName, dereference, errptr) pptr = strrchr(sptr, '.'); if (pptr != NULL) + { if (strcmp(pptr, DBSuffix)) pptr = NULL; - else - *pptr = '\0'; + else *pptr = '\0'; + } /* If dereferencing, then use search paths first */ if (!dereference) @@ -1594,7 +1598,7 @@ DBOpenOnly(cellDef, name, setFileName, errptr) */ int *errptr; /* Pointer to int to hold error value */ { - dbReadOpen(cellDef, name != NULL, setFileName, FALSE, errptr); + dbReadOpen(cellDef, setFileName, FALSE, errptr); } /* @@ -1907,7 +1911,8 @@ badTransform: { char savepath[1024]; strcpy(savepath, pathptr); - sprintf(path, "%s/%s", cellDef->cd_file, savepath); + int n = snprintf(path, sizeof(path), "%s/%s", cellDef->cd_file, savepath); + ASSERT(n < sizeof(path), "path"); } pathptr = &path[0]; *slashptr = '/'; @@ -1973,6 +1978,123 @@ badTransform: } else if (!strcmp(cwddir, pathptr)) pathOK = TRUE; + /* Apply same check as done in DBWprocs, which is to check the + * inode of the two files and declare the path okay if they are + * the same. This avoids conflicts in files that are referenced + * from two different places via different relative paths, or + * through symbolic links. + */ + + if ((pathOK == FALSE) && strcmp(subCellDef->cd_file, pathptr) + && (dereference == FALSE) && (firstUse == TRUE)) + { + struct stat statbuf; + ino_t inode; + + if (stat(subCellDef->cd_file, &statbuf) == 0) + { + inode = statbuf.st_ino; + + if (stat(pathptr, &statbuf) == 0) + { + if (inode == statbuf.st_ino) + pathOK = TRUE; + } + } + } + + if ((pathOK == FALSE) && strcmp(subCellDef->cd_file, pathptr) + && (dereference == FALSE) && (firstUse == TRUE)) + { + /* See if both paths are inside a git repository, and both + * git repositories have the same commit hash. Then the + * two layouts can be considered equivalent. If the "git" + * command fails for any reason, then ignore the error and + * continue. + */ + char *sl1ptr, *sl2ptr; + int link[2], nbytes, status; + pid_t pid; + char githash1[128]; + char githash2[128]; + char argstr[1024]; + + githash1[0] = '\0'; + githash2[0] = '\0'; + + /* Remove the file component */ + sl1ptr = strrchr(pathptr, '/'); + if (sl1ptr != NULL) *sl1ptr = '\0'; + + /* Check first file for a git hash */ + if (pipe(link) != -1) + { + FORK(pid); + if (pid == 0) + { + dup2(link[1], STDOUT_FILENO); + close(link[0]); + close(link[1]); + int n = snprintf(argstr, sizeof(argstr), "-C %s", pathptr); + ASSERT(n < sizeof(argstr), "argstr"); + execlp("git", argstr, "rev-parse", "HEAD", NULL); + _exit(122); /* see vfork man page for reason for _exit() */ + } + else + { + close(link[1]); + nbytes = read(link[0], githash1, sizeof(githash1)); + waitpid(pid, &status, 0); + } + } + + if (sl1ptr != NULL) *sl1ptr = '/'; + + if (githash1[0] != '\0') + { + /* Check the second repository */ + + /* Remove the file component */ + sl2ptr = strrchr(subCellDef->cd_file, '/'); + if (sl2ptr != NULL) *sl2ptr = '\0'; + + /* Check first file for a git hash */ + if (pipe(link) != -1) + { + FORK(pid); + if (pid == 0) + { + dup2(link[1], STDOUT_FILENO); + close(link[0]); + close(link[1]); + sprintf(argstr, "-C %s", subCellDef->cd_file); + execlp("git", argstr, "rev-parse", "HEAD", NULL); + _exit(123); /* see vfork man page for reason for _exit() */ + } + else + { + close(link[1]); + nbytes = read(link[0], githash2, sizeof(githash2)); + waitpid(pid, &status, 0); + } + } + + if (sl2ptr != NULL) *sl2ptr = '/'; + + if (githash2[0] != '\0') + { + /* Check if the repositories have the same hash */ + if (!strcmp(githash1, githash2)) + { + TxPrintf("Cells %s in %s and %s have matching git repository" + " commits and can be considered equivalent.\n", + slashptr + 1, subCellDef->cd_file, pathptr); + pathOK = TRUE; + } + } + } + } + if ((pathOK == FALSE) && strcmp(subCellDef->cd_file, pathptr) && (dereference == FALSE) && (firstUse == TRUE)) { @@ -1994,7 +2116,7 @@ badTransform: } else { - char *newname = (char *)mallocMagic(strlen(cellname) + 6); + char *newname = (char *)mallocMagic(strlen(cellname) + 7); int i = 0; /* To do: Run checksum on file (not yet implemented) */ @@ -2002,7 +2124,7 @@ badTransform: while (TRUE) { - sprintf(newname, "%s#%d", cellname, i); + sprintf(newname, "%s__%d", cellname, i); if (DBCellLookDef(newname) == NULL) break; i++; } @@ -2031,7 +2153,7 @@ badTransform: /* default path but the new cell has a (different) path. */ /* The paths only match if pathptr is the CWD. */ - else if ((pathptr != NULL) && (*pathptr != '\0')) + else if (*pathptr != '\0') { bool pathOK = FALSE; char *cwddir = getenv("PWD"); @@ -2071,7 +2193,7 @@ badTransform: } else { - char *newname = (char *)mallocMagic(strlen(cellname) + 6); + char *newname = (char *)mallocMagic(strlen(cellname) + 7); int i = 0; /* To do: Run checksum on file (not yet implemented) */ @@ -2079,7 +2201,7 @@ badTransform: while (TRUE) { - sprintf(newname, "%s#%d", cellname, i); + sprintf(newname, "%s__%d", cellname, i); if (DBCellLookDef(newname) == NULL) break; i++; } @@ -2193,7 +2315,7 @@ dbReadProperties(cellDef, line, len, f, scalen, scaled) int scalen; /* Scale up by this factor */ int scaled; /* Scale down by this factor */ { - char propertyname[128], propertyvalue[2048], *storedvalue; + char propertyname[128], propertyvalue[2049], *storedvalue; char *pvalueptr; int ntok; unsigned int noeditflag; @@ -2370,8 +2492,8 @@ dbReadProperties(cellDef, line, len, f, scalen, scaled) /* Skip forward four values in pvalueptr */ for (n = 0; n < 4; n++) { - while (!isspace(*pptr)) pptr++; - while (isspace(*pptr) && (*pptr != '\0')) pptr++; + while ((*pptr != '\0') && !isspace(*pptr)) pptr++; + while ((*pptr != '\0') && isspace(*pptr)) pptr++; } } } @@ -2917,7 +3039,7 @@ dbFgets(line, len, f) { char *cs; int l; - int c; + int c = EOF; do { @@ -3216,7 +3338,7 @@ dbGetPropFunc(key, value, propRec) propRec->keyValueList[propRec->idx] = (struct keyValuePair *)mallocMagic(sizeof(struct keyValuePair)); propRec->keyValueList[propRec->idx]->key = key; - propRec->keyValueList[propRec->idx]->value = value; + propRec->keyValueList[propRec->idx]->value = (char *)value; propRec->idx++; return 0; @@ -3871,7 +3993,7 @@ DBCellWrite(cellDef, fileName) * If so, write to the temp file and then rename it after * we're done. */ - if (tmpf = fopen(tmpname, "w")) + if ((tmpf = fopen(tmpname, "w"))) { result = DBCellWriteFile(cellDef, tmpf); (void) fclose(tmpf); diff --git a/database/DBlabel.c b/database/DBlabel.c index eb8001fc..388c9da6 100644 --- a/database/DBlabel.c +++ b/database/DBlabel.c @@ -24,6 +24,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include /* For sin(), cos(), and round() functions */ #include diff --git a/database/DBlabel2.c b/database/DBlabel2.c index b43d01ef..9396af1f 100644 --- a/database/DBlabel2.c +++ b/database/DBlabel2.c @@ -225,7 +225,7 @@ DBSrLabelLoc(rootUse, name, func, cdarg) char csave; Rect r; - if (cp = strrchr(name, '/')) + if ((cp = strrchr(name, '/'))) { csave = *cp; *cp = '\0'; diff --git a/database/DBpaint2.c b/database/DBpaint2.c index de3a1cbe..aa82305b 100644 --- a/database/DBpaint2.c +++ b/database/DBpaint2.c @@ -283,6 +283,7 @@ DBPaintValid(cellDef, rect, mask, dinfo) for (t = TT_SELECTBASE; t < DBNumUserLayers; t++) if (TTMaskHasType(&mmask, t)) + { if (DBIsContact(t)) { tMask = DBResidueMask(t); @@ -310,6 +311,7 @@ DBPaintValid(cellDef, rect, mask, dinfo) (t << 14) : t) : t); DBPaint(cellDef, rect, tloc); } + } } /* @@ -382,6 +384,7 @@ DBEraseValid(cellDef, rect, mask, dinfo) for (t = TT_SELECTBASE; t < DBNumUserLayers; t++) if (TTMaskHasType(&mmask, t)) + { if (DBIsContact(t)) { tMask = DBResidueMask(t); @@ -409,4 +412,5 @@ DBEraseValid(cellDef, rect, mask, dinfo) (t << 14) : t) : t); DBErase(cellDef, rect, tloc); } + } } diff --git a/database/DBtech.c b/database/DBtech.c index 2ea3676f..47f8b818 100644 --- a/database/DBtech.c +++ b/database/DBtech.c @@ -223,7 +223,7 @@ DBTechSetVersion(sectionName, argc, argv) major = minor = rev = 0; rmajor = rminor = rrev = 0; - if (sscanf(vstring, "%d.%d.%d", &rmajor, &rminor, &rrev) == 0) + if (sscanf(vstring, "%d.%d.%d", &rmajor, &rminor, &rrev) != 3) { TechError("Badly formed magic version string, should be major.minor.rev\n"); return FALSE; diff --git a/database/DBtechtype.c b/database/DBtechtype.c index e7fe51ed..f8509df6 100644 --- a/database/DBtechtype.c +++ b/database/DBtechtype.c @@ -70,28 +70,28 @@ TileTypeBitMask DBTechActiveLayerBits; /* Layers marked locked in the techfile * /* Table of default, builtin planes */ DefaultPlane dbTechDefaultPlanes[] = { - PL_ROUTER, "router", - PL_DRC_ERROR, "designRuleError", - PL_DRC_CHECK, "designRuleCheck", - PL_M_HINT, "mhint", - PL_F_HINT, "fhint", - PL_R_HINT, "rhint", - 0, 0, 0 + {PL_ROUTER, "router"}, + {PL_DRC_ERROR, "designRuleError"}, + {PL_DRC_CHECK, "designRuleCheck"}, + {PL_M_HINT, "mhint"}, + {PL_F_HINT, "fhint"}, + {PL_R_HINT, "rhint"}, + {0, NULL} }; /* Table of default, builtin types */ DefaultType dbTechDefaultTypes[] = { - TT_SPACE, -1, "space", FALSE, - TT_CHECKPAINT, PL_DRC_CHECK, "checkpaint,CP", FALSE, - TT_CHECKSUBCELL, PL_DRC_CHECK, "checksubcell,CS", FALSE, - TT_ERROR_P, PL_DRC_ERROR, "error_p,EP", FALSE, - TT_ERROR_S, PL_DRC_ERROR, "error_s,ES", FALSE, - TT_ERROR_PS, PL_DRC_ERROR, "error_ps,EPS", FALSE, - TT_MAGNET, PL_M_HINT, "magnet,mag", TRUE, - TT_FENCE, PL_F_HINT, "fence,f", TRUE, - TT_ROTATE, PL_R_HINT, "rotate,r", TRUE, - 0, 0, NULL, 0 + {TT_SPACE, -1, "space", FALSE}, + {TT_CHECKPAINT, PL_DRC_CHECK, "checkpaint,CP", FALSE}, + {TT_CHECKSUBCELL, PL_DRC_CHECK, "checksubcell,CS", FALSE}, + {TT_ERROR_P, PL_DRC_ERROR, "error_p,EP", FALSE}, + {TT_ERROR_S, PL_DRC_ERROR, "error_s,ES", FALSE}, + {TT_ERROR_PS, PL_DRC_ERROR, "error_ps,EPS", FALSE}, + {TT_MAGNET, PL_M_HINT, "magnet,mag", TRUE}, + {TT_FENCE, PL_F_HINT, "fence,f", TRUE}, + {TT_ROTATE, PL_R_HINT, "rotate,r", TRUE}, + {0, 0, NULL, 0} }; /* Forward declarations */ diff --git a/database/DBtiles.c b/database/DBtiles.c index 1996b6bd..cfd8f8aa 100644 --- a/database/DBtiles.c +++ b/database/DBtiles.c @@ -565,15 +565,15 @@ enumerate: theight = TOP(tp) - BOTTOM(tp); twidth = RIGHT(tp) - LEFT(tp); f1 = (rect->r_ybot > MINFINITY + 2) ? - (TOP(tp) - rect->r_ybot) * twidth : DLONG_MAX; + (dlong)(TOP(tp) - rect->r_ybot) * (dlong)twidth : DLONG_MAX; f2 = (rect->r_ytop < INFINITY - 2) ? - (rect->r_ytop - BOTTOM(tp)) * twidth : DLONG_MAX; + (dlong)(rect->r_ytop - BOTTOM(tp)) * (dlong)twidth : DLONG_MAX; if (TTMaskHasType(mask, SplitLeftType(tp))) { /* !Outside-of-triangle check */ f4 = (rect->r_xbot > MINFINITY + 2) ? - (rect->r_xbot - LEFT(tp)) * theight : DLONG_MIN; + (dlong)(rect->r_xbot - LEFT(tp)) * (dlong)theight : DLONG_MIN; if (SplitDirection(tp) ? (f1 > f4) : (f2 > f4)) { TiSetBody(tp, (ClientData)((TileType)TiGetBody(tp) @@ -587,7 +587,7 @@ enumerate: { /* !Outside-of-triangle check */ f3 = (rect->r_xtop < INFINITY - 2) ? - (RIGHT(tp) - rect->r_xtop) * theight : DLONG_MIN; + (dlong)(RIGHT(tp) - rect->r_xtop) * (dlong)theight : DLONG_MIN; if (SplitDirection(tp) ? (f2 > f3) : (f1 > f3)) { TiSetBody(tp, (ClientData)((TileType)TiGetBody(tp) diff --git a/database/DBundo.c b/database/DBundo.c index 255c3af8..73b98414 100644 --- a/database/DBundo.c +++ b/database/DBundo.c @@ -260,7 +260,7 @@ dbUndoSplitForw(us) { /* Create internal fracture */ if (dbUndoLastCell == NULL) return; - DBSplitTile(dbUndoLastCell->cd_planes[us->sue_plane], &us->sue_point, + DBSplitTile(dbUndoLastCell->cd_planes[(unsigned char)us->sue_plane], &us->sue_point, us->sue_splitx); } @@ -276,7 +276,7 @@ dbUndoSplitBack(us) srect.r_ur.p_y = us->sue_point.p_y + 1; /* Remove internal fracture and restore original split tile */ - DBMergeNMTiles0(dbUndoLastCell->cd_planes[us->sue_plane], &srect, + DBMergeNMTiles0(dbUndoLastCell->cd_planes[(unsigned char)us->sue_plane], &srect, (PaintUndoInfo *)NULL, TRUE); } @@ -314,20 +314,20 @@ dbUndoPaintForw(up) loctype = (up->pue_oldtype & TT_LEFTMASK); dinfo = TT_DIAGONAL | (up->pue_oldtype & TT_DIRECTION); - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], - dinfo, &up->pue_rect, DBStdEraseTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], + dinfo, &up->pue_rect, DBStdEraseTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); loctype = (up->pue_oldtype & TT_RIGHTMASK) >> 14; dinfo |= TT_SIDE; - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], - dinfo, &up->pue_rect, DBStdEraseTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], + dinfo, &up->pue_rect, DBStdEraseTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); } else - DBPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], &up->pue_rect, - DBStdEraseTbl(up->pue_oldtype, up->pue_plane), + DBPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect, + DBStdEraseTbl(up->pue_oldtype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); if (up->pue_newtype & TT_DIAGONAL) @@ -335,20 +335,20 @@ dbUndoPaintForw(up) loctype = (up->pue_newtype & TT_LEFTMASK); dinfo = TT_DIAGONAL | (up->pue_newtype & TT_DIRECTION); - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], - dinfo, &up->pue_rect, DBStdPaintTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], + dinfo, &up->pue_rect, DBStdPaintTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); loctype = (up->pue_newtype & TT_RIGHTMASK) >> 14; dinfo |= TT_SIDE; - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], - dinfo, &up->pue_rect, DBStdPaintTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], + dinfo, &up->pue_rect, DBStdPaintTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); } else - DBPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], &up->pue_rect, - DBStdPaintTbl(up->pue_newtype, up->pue_plane), + DBPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect, + DBStdPaintTbl(up->pue_newtype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); endPaintFor: dbUndoUndid = TRUE; @@ -368,20 +368,20 @@ dbUndoPaintBack(up) loctype = (up->pue_newtype & TT_LEFTMASK); dinfo = TT_DIAGONAL | (up->pue_newtype & TT_DIRECTION); - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], - dinfo, &up->pue_rect, DBStdEraseTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], + dinfo, &up->pue_rect, DBStdEraseTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); loctype = (up->pue_newtype & TT_RIGHTMASK) >> 14; dinfo |= TT_SIDE; - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], - dinfo, &up->pue_rect, DBStdEraseTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], + dinfo, &up->pue_rect, DBStdEraseTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); } else - DBPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], &up->pue_rect, - DBStdEraseTbl(up->pue_newtype, up->pue_plane), + DBPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect, + DBStdEraseTbl(up->pue_newtype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); if (up->pue_oldtype & TT_DIAGONAL) @@ -389,23 +389,23 @@ dbUndoPaintBack(up) loctype = (up->pue_oldtype & TT_LEFTMASK); dinfo = TT_DIAGONAL | (up->pue_oldtype & TT_DIRECTION); - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], dinfo, - &up->pue_rect, DBStdPaintTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], dinfo, + &up->pue_rect, DBStdPaintTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); loctype = (up->pue_oldtype & TT_RIGHTMASK) >> 14; dinfo |= TT_SIDE; - DBNMPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], dinfo, - &up->pue_rect, DBStdPaintTbl(loctype, up->pue_plane), + DBNMPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], dinfo, + &up->pue_rect, DBStdPaintTbl(loctype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); - DBMergeNMTiles0(dbUndoLastCell->cd_planes[up->pue_plane], + DBMergeNMTiles0(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect, (PaintUndoInfo *)NULL, TRUE); } else - DBPaintPlane(dbUndoLastCell->cd_planes[up->pue_plane], &up->pue_rect, - DBStdPaintTbl(up->pue_oldtype, up->pue_plane), + DBPaintPlane(dbUndoLastCell->cd_planes[(unsigned char)up->pue_plane], &up->pue_rect, + DBStdPaintTbl(up->pue_oldtype, (unsigned char)up->pue_plane), (PaintUndoInfo *) NULL); endPaintBack: @@ -788,9 +788,11 @@ dbUndoCellBack(up) break; case UNDO_CELL_PLACE: use = findUse(up, TRUE); - DBUnLinkCell(use, up->cue_parent); - DBDeleteCell(use); - (void) DBCellDeleteUse(use); + if (use) { + DBUnLinkCell(use, up->cue_parent); + DBDeleteCell(use); + (void) DBCellDeleteUse(use); + } DBReComputeBbox(up->cue_parent); DBWAreaChanged(up->cue_parent, &up->cue_bbox, DBW_ALLWINDOWS, (TileTypeBitMask *) NULL); @@ -804,9 +806,11 @@ dbUndoCellBack(up) */ case UNDO_CELL_CLRID: use = findUse(up, FALSE); /* Find it with a NULL id */ - (void) DBReLinkCell(use, up->cue_id); - DBWAreaChanged(up->cue_parent, &up->cue_bbox, - (int) ~use->cu_expandMask, &DBAllButSpaceBits); + if (use) { + (void) DBReLinkCell(use, up->cue_id); + DBWAreaChanged(up->cue_parent, &up->cue_bbox, + (int) ~use->cu_expandMask, &DBAllButSpaceBits); + } break; /* * The following is a hack. @@ -817,16 +821,20 @@ dbUndoCellBack(up) */ case UNDO_CELL_SETID: use = findUse(up, TRUE); /* Find it with current id */ - DBUnLinkCell(use, up->cue_parent); - freeMagic(use->cu_id); - use->cu_id = (char *) NULL; + if (use) { + DBUnLinkCell(use, up->cue_parent); + freeMagic(use->cu_id); + use->cu_id = (char *) NULL; + } break; case UNDO_CELL_LOCKDOWN: use = findUse(up, TRUE); - use->cu_flags = up->cue_flags; - DBWAreaChanged(up->cue_parent, &up->cue_bbox, + if (use) { + use->cu_flags = up->cue_flags; + DBWAreaChanged(up->cue_parent, &up->cue_bbox, (int) ~use->cu_expandMask, &DBAllButSpaceBits); + } break; } } diff --git a/dbwind/DBWelement.c b/dbwind/DBWelement.c index e6e1ff19..408be04e 100644 --- a/dbwind/DBWelement.c +++ b/dbwind/DBWelement.c @@ -192,9 +192,9 @@ DBWPrintElements(cellDef, flagmask, reducer) char *etypes[] = {"rectangle", "line", "text"}; HashStartSearch(&hs); - while (he = HashNext(&elementTable, &hs)) + while ((he = HashNext(&elementTable, &hs))) { - if (elem = (DBWElement *)HashGetValue(he)) + if ((elem = (DBWElement *)HashGetValue(he))) { if ((elem->rootDef == cellDef) && (elem->flags & flagmask)) { @@ -292,9 +292,9 @@ DBWScaleElements(n, d) extern bool DBScalePoint(); /* Forward declaration */ HashStartSearch(&hs); - while (he = HashNext(&elementTable, &hs)) + while ((he = HashNext(&elementTable, &hs))) { - if (elem = (DBWElement *)HashGetValue(he)) + if ((elem = (DBWElement *)HashGetValue(he))) { /* scale area rectangle */ DBScalePoint(&elem->area.r_ll, n, d); @@ -630,24 +630,24 @@ DBWElementNames() HashEntry *he; #ifndef MAGIC_WRAPPER - TxPrintf(stdout, "Known elements:"); + TxPrintf("Known elements:"); #endif HashStartSearch(&hs); - while (he = HashNext(&elementTable, &hs)) + while ((he = HashNext(&elementTable, &hs))) { - if (elem = (DBWElement *)HashGetValue(he)) + if ((elem = (DBWElement *)HashGetValue(he))) { #ifdef MAGIC_WRAPPER Tcl_AppendElement(magicinterp, he->h_key.h_name); #else - TxPrintf(stdout, " %s", he->h_key.h_name); + TxPrintf(" %s", he->h_key.h_name); #endif } } #ifndef MAGIC_WRAPPER - TxPrintf(stdout, "/n"); + TxPrintf("/n"); #endif } @@ -672,27 +672,27 @@ DBWElementInbox(area) int sqdist; #ifndef MAGIC_WRAPPER - TxPrintf(stdout, "Element(s) inside box: "); + TxPrintf("Element(s) inside box: "); #endif HashStartSearch(&hs); - while (he = HashNext(&elementTable, &hs)) + while ((he = HashNext(&elementTable, &hs))) { - if (elem = (DBWElement *)HashGetValue(he)) + if ((elem = (DBWElement *)HashGetValue(he))) { if (GEO_SURROUND(area, &elem->area)) { #ifdef MAGIC_WRAPPER Tcl_AppendElement(magicinterp, he->h_key.h_name); #else - TxPrintf(stdout, " %s", he->h_key.h_name); + TxPrintf(" %s", he->h_key.h_name); #endif } } } #ifndef MAGIC_WRAPPER - TxPrintf(stdout, "/n"); + TxPrintf("/n"); #endif } diff --git a/dbwind/DBWundo.c b/dbwind/DBWundo.c index 3a2e148d..37b78db3 100644 --- a/dbwind/DBWundo.c +++ b/dbwind/DBWundo.c @@ -208,7 +208,7 @@ dbwUndoChangeEdit(ep) Rect area; CellUse *use; CellDef *editDef, *parent; - static Rect origin = {-1, -1, 1, 1}; + static Rect origin = {{-1, -1}, {1, 1}}; /* Redisplay the old edit cell */ GeoTransRect(&EditToRootTransform, &(EditCellUse->cu_def->cd_bbox), &area); diff --git a/debug/debugFlags.c b/debug/debugFlags.c index 7e759569..9a71b392 100644 --- a/debug/debugFlags.c +++ b/debug/debugFlags.c @@ -121,7 +121,7 @@ DebugAddFlag(clientID, name) if (id < 0 || id >= debugNumClients) { - TxError("DebugAddFlag: bad client id %d (flag %s)\n", clientID, name); + TxError("DebugAddFlag: bad client id %lu (flag %s)\n", clientID, name); return (0); } @@ -165,7 +165,7 @@ DebugShow(clientID) if (id < 0 || id >= debugNumClients) { - TxError("DebugShow: bad client id %d\n", clientID); + TxError("DebugShow: bad client id %lu\n", clientID); return; } dc = &debugClients[id]; @@ -208,7 +208,7 @@ DebugSet(clientID, argc, argv, value) if (id < 0 || id >= debugNumClients) { - TxError("DebugSet: bad client id %d\n", clientID); + TxError("DebugSet: bad client id %lu\n", (unsigned long)clientID); return; } dc = &debugClients[id]; diff --git a/debug/hist.c b/debug/hist.c index d112bd2e..9cf07910 100644 --- a/debug/hist.c +++ b/debug/hist.c @@ -141,8 +141,10 @@ HistAdd(name, ptrKeys, value) { Histogram * h; - if((h=histFind(name, ptrKeys))==(Histogram *) NULL) + if((h=histFind(name, ptrKeys))==(Histogram *) NULL) { HistCreate(name, ptrKeys, 0, 20, 10); + h=histFind(name, ptrKeys); + } h->hi_cum+=value; if(value < h->hi_lo) diff --git a/doc/html/property.html b/doc/html/property.html index 281db7db..0d233d11 100644 --- a/doc/html/property.html +++ b/doc/html/property.html @@ -105,6 +105,10 @@ Attach a "property" (string key and value pair) to the edit cell are required to accommodate pins). Any set-back applied by the "lef write -hide " option will be applied to this obstruction box. +
flatten +
This property is used in conjunction with the "flatten -doproperty" + command option and marks the cell for flattening. Cells without + this property defined will not be flattened.
device
This property declares that the cell is a device or contains a single device that is not a known extractable device defined in diff --git a/drc/DRCarray.c b/drc/DRCarray.c index cbaaaffb..4e48926a 100644 --- a/drc/DRCarray.c +++ b/drc/DRCarray.c @@ -44,7 +44,7 @@ extern int drcArrayYankFunc(), drcArrayOverlapFunc(); static DRCCookie drcArrayCookie = { 0, 0, 0, 0, - { 0 }, { 0 }, + { {0} }, { {0} }, 0, 0, 0, DRC_ARRAY_OVERLAP_TAG, (DRCCookie *) NULL diff --git a/drc/DRCbasic.c b/drc/DRCbasic.c index 1ea451e2..3cf2e14e 100644 --- a/drc/DRCbasic.c +++ b/drc/DRCbasic.c @@ -46,7 +46,7 @@ int dbDRCDebug = 0; static DRCCookie drcOverlapCookie = { 0, 0, 0, 0, - { 0 }, { 0 }, + { {0} }, { {0} }, 0, 0, 0, DRC_OVERLAP_TAG, (DRCCookie *) NULL @@ -176,7 +176,7 @@ areaCheck(tile, arg) unsigned int i; int sqx, sqy; int sdist = arg->dCD_radial & 0xfff; - long sstest, ssdist = sdist * sdist; + long sstest, ssdist = (long) sdist * sdist; if ((arg->dCD_radial & RADIAL_NW) != 0) { @@ -692,9 +692,15 @@ drcTile (tile, arg) cptr->drcc_dist++; if (cptr->drcc_flags & DRC_REVERSE) + { mrd = drcCanonicalMaxwidth(tpleft, GEO_WEST, arg, cptr); + triggered = 0; + } else if (firsttile) + { mrd = drcCanonicalMaxwidth(tile, GEO_EAST, arg, cptr); + triggered = 0; + } if (!trigpending || (DRCCurStyle->DRCFlags & DRC_FLAGS_WIDEWIDTH_NONINCLUSIVE)) cptr->drcc_dist--; @@ -1089,9 +1095,15 @@ drcTile (tile, arg) cptr->drcc_dist++; if (cptr->drcc_flags & DRC_REVERSE) + { mrd = drcCanonicalMaxwidth(tpbot, GEO_SOUTH, arg, cptr); + triggered = 0; + } else if (firsttile) + { mrd = drcCanonicalMaxwidth(tile, GEO_NORTH, arg, cptr); + triggered = 0; + } if (!trigpending || (DRCCurStyle->DRCFlags & DRC_FLAGS_WIDEWIDTH_NONINCLUSIVE)) cptr->drcc_dist--; diff --git a/drc/DRCcif.c b/drc/DRCcif.c index 3a170ff6..54a359f3 100644 --- a/drc/DRCcif.c +++ b/drc/DRCcif.c @@ -1076,7 +1076,7 @@ areaCifCheck(tile, arg) unsigned int i; int sqx, sqy; int sdist = arg->dCD_radial & 0xfff; - long sstest, ssdist = sdist * sdist; + long sstest, ssdist = (long) sdist * sdist; if ((arg->dCD_radial & RADIAL_NW) != 0) { @@ -1184,7 +1184,7 @@ drcCifArea(argc, argv) DRCCookie *dpnext, *dpnew; TileType i, j; int plane; - int thislayer; + int thislayer = -1; int scalefactor; if (drcCifStyle == NULL) @@ -1246,7 +1246,7 @@ drcCifMaxwidth(argc, argv) TileType i, j; int plane; int bend; - int thislayer; + int thislayer = -1; int scalefactor; if (drcCifStyle == NULL) diff --git a/drc/DRCsubcell.c b/drc/DRCsubcell.c index a301da4b..7d82cc66 100644 --- a/drc/DRCsubcell.c +++ b/drc/DRCsubcell.c @@ -55,7 +55,7 @@ static ClientData drcSubClientData; static DRCCookie drcSubcellCookie = { 0, 0, 0, 0, - { 0 }, { 0 }, + { {0} }, { {0} }, 0, 0, 0, DRC_SUBCELL_OVERLAP_TAG, (DRCCookie *) NULL @@ -68,7 +68,7 @@ static DRCCookie drcSubcellCookie = { static DRCCookie drcInSubCookie = { 0, 0, 0, 0, - { 0 }, { 0 }, + { {0} }, { {0} }, 0, 0, 0, DRC_IN_SUBCELL_TAG, (DRCCookie *) NULL @@ -82,7 +82,7 @@ static DRCCookie drcInSubCookie = { static DRCCookie drcOffGridCookie = { 0, 0, 0, 0, - { 0 }, { 0 }, + { {0} }, { {0} }, 0, 0, 0, DRC_OFFGRID_TAG, (DRCCookie *) NULL @@ -965,5 +965,5 @@ drcIncCount(def, area, rule, count) DRCCookie *rule; int *count; { - *count++; + (*count)++; } diff --git a/drc/DRCtech.c b/drc/DRCtech.c index d5242355..7311de94 100644 --- a/drc/DRCtech.c +++ b/drc/DRCtech.c @@ -826,7 +826,7 @@ DRCTechLine(sectionName, argc, argv) if (DRCStyleList == NULL) { - char *locargv[2][10] = {"style", "default"}; + char *locargv[2][10] = {{"style"}, {"default"}}; if (DRCTechLine(sectionName, 2, locargv) == FALSE) return FALSE; @@ -1022,53 +1022,53 @@ DRCTechAddRule(sectionName, argc, argv) int (*rk_proc)(); /* Procedure implementing this keyword */ char *rk_err; /* Error message */ } ruleKeys[] = { - "angles", 4, 4, drcAngles, - "layers 45|90 why", - "edge", 8, 9, drcEdge, - "layers1 layers2 distance okTypes cornerTypes cornerDistance why [plane]", - "edge4way", 8, 9, drcEdge, - "layers1 layers2 distance okTypes cornerTypes cornerDistance why [plane]", - "exact_overlap", 2, 2, drcExactOverlap, - "layers", - "extend", 5, 6, drcExtend, - "layers1 layers2 distance [option] why", - "no_overlap", 3, 3, drcNoOverlap, - "layers1 layers2", - "option", 2, 2, drcOption, - "option_name option_value", - "overhang", 5, 5, drcOverhang, - "layers1 layers2 distance why", - "rect_only", 3, 3, drcRectOnly, - "layers why", - "spacing", 6, 7, drcSpacing, - "layers1 layers2 separation [layers3] adjacency why", - "stepsize", 2, 2, drcStepSize, - "step_size", - "surround", 6, 7, drcSurround, - "layers1 layers2 distance presence why", - "width", 4, 5, drcWidth, - "layers width why", - "widespacing", 7, 8, drcSpacing, - "layers1 width layers2 separation adjacency why", - "area", 5, 5, drcArea, - "layers area horizon why", - "off_grid", 4, 4, drcOffGrid, - "layers pitch why", - "maxwidth", 4, 5, drcMaxwidth, - "layers maxwidth bends why", - "cifstyle", 2, 2, drcCifSetStyle, - "cif_style", - "cifwidth", 4, 4, drcCifWidth, - "layers width why", - "cifspacing", 6, 6, drcCifSpacing, - "layers1 layers2 separation adjacency why", - "cifarea", 5, 5, drcCifArea, - "layers area horizon why", - "cifmaxwidth", 5, 5, drcCifMaxwidth, - "layers maxwidth bends why", - "rectangle", 5, 5, drcRectangle, - "layers maxwidth [even|odd|any] why", - 0 + {"angles", 4, 4, drcAngles, + "layers 45|90 why"}, + {"edge", 8, 9, drcEdge, + "layers1 layers2 distance okTypes cornerTypes cornerDistance why [plane]"}, + {"edge4way", 8, 9, drcEdge, + "layers1 layers2 distance okTypes cornerTypes cornerDistance why [plane]"}, + {"exact_overlap", 2, 2, drcExactOverlap, + "layers"}, + {"extend", 5, 6, drcExtend, + "layers1 layers2 distance [option] why"}, + {"no_overlap", 3, 3, drcNoOverlap, + "layers1 layers2"}, + {"option", 2, 2, drcOption, + "option_name option_value"}, + {"overhang", 5, 5, drcOverhang, + "layers1 layers2 distance why"}, + {"rect_only", 3, 3, drcRectOnly, + "layers why"}, + {"spacing", 6, 7, drcSpacing, + "layers1 layers2 separation [layers3] adjacency why"}, + {"stepsize", 2, 2, drcStepSize, + "step_size"}, + {"surround", 6, 7, drcSurround, + "layers1 layers2 distance presence why"}, + {"width", 4, 5, drcWidth, + "layers width why"}, + {"widespacing", 7, 8, drcSpacing, + "layers1 width layers2 separation adjacency why"}, + {"area", 5, 5, drcArea, + "layers area horizon why"}, + {"off_grid", 4, 4, drcOffGrid, + "layers pitch why"}, + {"maxwidth", 4, 5, drcMaxwidth, + "layers maxwidth bends why"}, + {"cifstyle", 2, 2, drcCifSetStyle, + "cif_style"}, + {"cifwidth", 4, 4, drcCifWidth, + "layers width why"}, + {"cifspacing", 6, 6, drcCifSpacing, + "layers1 layers2 separation adjacency why"}, + {"cifarea", 5, 5, drcCifArea, + "layers area horizon why"}, + {"cifmaxwidth", 5, 5, drcCifMaxwidth, + "layers maxwidth bends why"}, + {"rectangle", 5, 5, drcRectangle, + "layers maxwidth [even|odd|any] why"}, + {0} }, *rp; drcRulesSpecified += 1; @@ -1216,7 +1216,7 @@ drcExtend(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pMask2)) + if ((pset = (DBTypesOnSamePlane(i, j) & pMask2))) { /* Edge depends on whether or not the extension is */ /* on the same plane as the layer from which it is */ @@ -1365,7 +1365,7 @@ drcWidth(argc, argv) * and a type in 'set'. */ - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&setC, i) && TTMaskHasType(&set, j)) { @@ -1468,7 +1468,7 @@ drcArea(argc, argv) * to the right of any edge between a type in '~set' * and a type in 'set'. */ - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&setC, i) && TTMaskHasType(&set, j)) { @@ -1540,7 +1540,7 @@ drcOffGrid(argc, argv) * to the right of any edge between a type in '~set' * and a type in 'set'. */ - if (pset = (DBTypesOnSamePlane(i, j))) + if ((pset = (DBTypesOnSamePlane(i, j)))) { if (TTMaskHasType(&setC, i) && TTMaskHasType(&set, j)) { @@ -1673,7 +1673,7 @@ drcMaxwidth(argc, argv) * to the right of any edge between a type in '~set' * and a type in 'set'. */ - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&setC, i) && TTMaskHasType(&set, j)) { @@ -1769,7 +1769,7 @@ drcAngles(argc, argv) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { /* Inside corners */ if (TTMaskHasType(&set, i) && TTMaskHasType(&set2, j)) @@ -1916,7 +1916,7 @@ drcSpacing3(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&set1, i) && TTMaskHasType(&set3, j)) { @@ -2096,7 +2096,7 @@ drcMaskSpacing(set1, set2, pmask1, pmask2, wwidth, distance, adjacency, for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask1)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask1))) { plane = LowestMaskBit(pset); @@ -2321,7 +2321,7 @@ drcMaskSpacing(set1, set2, pmask1, pmask2, wwidth, distance, adjacency, if (needtrigger) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask1)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask1))) { plane = LowestMaskBit(pset); @@ -2710,7 +2710,7 @@ drcEdge(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pMask1)) + if ((pset = (DBTypesOnSamePlane(i, j) & pMask1))) { if (TTMaskHasType(&set1, i) && TTMaskHasType(&set2, j)) { @@ -2827,7 +2827,7 @@ drcOverhang(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pMask2)) + if ((pset = (DBTypesOnSamePlane(i, j) & pMask2))) { if ((pset & pMask1) != 0) { @@ -2941,7 +2941,7 @@ drcRectOnly(argc, argv) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&set1, i) && TTMaskHasType(&set2, j)) { @@ -3094,7 +3094,7 @@ drcSurround(argc, argv) if (isDirectional) { - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { /* Directional surround is done entirely differently */ @@ -3141,7 +3141,7 @@ drcSurround(argc, argv) } else { - if (pset = (DBTypesOnSamePlane(i, j) & pmask2)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask2))) { if (TTMaskHasType(&set1, i) && TTMaskHasType(&set2, j)) { @@ -3178,7 +3178,7 @@ drcSurround(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; /* Ignore false edges */ - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&setM, i) && TTMaskHasType(&set2, j)) { @@ -3212,7 +3212,7 @@ drcSurround(argc, argv) /* Add an extra rule when presence of the surrounding */ /* layer is required. Rule is different if planes match. */ - if (pset = pmask & pmask2) + if ((pset = pmask & pmask2)) { TTMaskZero(&invM); TTMaskSetMask(&invM, &setM); @@ -3224,7 +3224,7 @@ drcSurround(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask & pmask2)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask & pmask2))) { plane1 = LowestMaskBit(pset); if (TTMaskHasType(&setM, i) && TTMaskHasType(&invM, j)) @@ -3258,7 +3258,7 @@ drcSurround(argc, argv) for (j = 0; j < DBNumTypes; j++) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pmask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pmask))) { if (TTMaskHasType(&setM, i) && TTMaskHasType(&invM, j)) { @@ -3456,7 +3456,7 @@ drcRectangle(argc, argv) { if (i == j) continue; - if (pset = (DBTypesOnSamePlane(i, j) & pMask)) + if ((pset = (DBTypesOnSamePlane(i, j) & pMask))) { if (TTMaskHasType(&types, i) && TTMaskHasType(¬types, j)) { @@ -4138,7 +4138,7 @@ DRCTechScale(scalen, scaled) int scalegcf; if (DRCCurStyle == NULL) return; - else if (scalen == scaled == 1) return; + else if (scalen == scaled) return; /* Revert DRC rules to original (unscaled) values */ drcScaleUp(DRCCurStyle, DRCCurStyle->DRCScaleFactorN); @@ -4362,7 +4362,7 @@ DRCGetDefaultLayerSurround(ttype1, ttype2) cset = &cptr->drcc_corner; if (TTMaskHasType(set, TT_SPACE) && !TTMaskHasType(set, ttype1)) if ((TTMaskHasType(cset, ttype2)) && - (cptr->drcc_flags && DRC_BOTHCORNERS) && + (cptr->drcc_flags & DRC_BOTHCORNERS) && (cptr->drcc_edgeplane == cptr->drcc_plane) && (cptr->drcc_dist == cptr->drcc_cdist)) { diff --git a/ext2sim/ext2sim.c b/ext2sim/ext2sim.c index a4e87cbd..1008cfab 100644 --- a/ext2sim/ext2sim.c +++ b/ext2sim/ext2sim.c @@ -19,6 +19,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include /* for atof() */ #include +#include #include #include /* for sqrt() in bipolar L,W calculation */ @@ -534,7 +535,7 @@ runexttosim: if (err_result == TRUE) { - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } @@ -548,7 +549,7 @@ runexttosim: if (w == (MagWindow *) NULL) { TxError("Point to a window or specify a cell name.\n"); - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } inName = ((CellUse *) w->w_surfaceID)->cu_def->cd_name; @@ -585,7 +586,7 @@ runexttosim: #else TxError("exttosim: Unable to open file %s for writing\n", simesOutName); #endif - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } if (!esNoAlias && (esAliasF = fopen(esAliasName, "w")) == NULL) @@ -598,7 +599,7 @@ runexttosim: #else TxError("exttosim: Unable to open file %s for writing\n", esAliasName); #endif - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } if (!esNoLabel && (esLabF = fopen(esLabelName, "w")) == NULL) @@ -617,7 +618,7 @@ runexttosim: /* Read the hierarchical description of the input circuit */ if (EFReadFile(inName, FALSE, esDoSimExtResis, FALSE, FALSE) == FALSE) { - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } @@ -1338,8 +1339,8 @@ FILE *outf; suf = EFHNToStr(suffix); if (fetInfo[type].defSubs && strcasecmp(suf,fetInfo[type].defSubs) == 0) { l = strlen(suf) - 1; - if ( ( EFOutputFlags & EF_TRIMGLOB ) && suf[l] =='!' || - ( EFOutputFlags & EF_TRIMLOCAL ) && suf[l] == '#' ) + if ( (( EFOutputFlags & EF_TRIMGLOB ) && suf[l] =='!') || + (( EFOutputFlags & EF_TRIMLOCAL ) && suf[l] == '#') ) suf[l] = '\0' ; if ( esFormat == SU ) fprintf(outf, "S_"); diff --git a/ext2sim/sim2simp.c b/ext2sim/sim2simp.c index 59a65739..b3029d53 100644 --- a/ext2sim/sim2simp.c +++ b/ext2sim/sim2simp.c @@ -31,7 +31,7 @@ char *s; return p; } -int parseAttr(str, a, p) +void parseAttr(str, a, p) char *str; int *a, *p; { diff --git a/ext2spice/ext2hier.c b/ext2spice/ext2hier.c index 0fe10f25..42d6786d 100644 --- a/ext2spice/ext2hier.c +++ b/ext2spice/ext2hier.c @@ -167,13 +167,13 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) fprintf(esSpiceF, " %s=", plist->parm_name); parmval = dev->dev_area; if (esScale < 0) - fprintf(esSpiceF, "%g", parmval * scale * scale); + fprintf(esSpiceF, "%g", (double)parmval * scale * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", parmval * scale * scale + fprintf(esSpiceF, "%g", (double)parmval * scale * scale * esScale * esScale * plist->parm_scale * 1E-12); else - esSIvalue(esSpiceF, 1.0E-12 * (parmval + plist->parm_offset) + esSIvalue(esSpiceF, 1.0E-12 * ((double)parmval + plist->parm_offset) * scale * scale * esScale * esScale); } else @@ -217,11 +217,11 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", parmval * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", parmval * scale - * esScale * plist->parm_scale * 1E-6); + fprintf(esSpiceF, "%g", (double)parmval * (double)scale + * (double)esScale * (double)plist->parm_scale * 1E-6); else - esSIvalue(esSpiceF, (parmval + plist->parm_offset) - * scale * esScale * 1.0E-6); + esSIvalue(esSpiceF, ((double)parmval + (double)plist->parm_offset) + * (double)scale * (double)esScale * 1.0E-6); } else { @@ -262,7 +262,7 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", l * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", l * scale * esScale + fprintf(esSpiceF, "%g", (double)l * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, 1.0E-6 * (l + plist->parm_offset) @@ -286,7 +286,7 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", dval * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", dval * scale * esScale + fprintf(esSpiceF, "%g", (double)dval * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, (dval + plist->parm_offset) @@ -304,7 +304,7 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", w * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", w * scale * esScale + fprintf(esSpiceF, "%g", (double)w * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, 1.0E-6 * (w + plist->parm_offset) @@ -321,8 +321,8 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", dev->dev_rect.r_xbot * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", dev->dev_rect.r_xbot * scale - * esScale * plist->parm_scale * 1E-6); + fprintf(esSpiceF, "%g", (double)dev->dev_rect.r_xbot * (double)scale + * (double)esScale * (double)plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, (dev->dev_rect.r_xbot + plist->parm_offset) * scale * esScale * 1.0E-6); @@ -332,8 +332,8 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", dev->dev_rect.r_ybot * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", dev->dev_rect.r_ybot * scale - * esScale * plist->parm_scale * 1E-6); + fprintf(esSpiceF, "%g", (double)dev->dev_rect.r_ybot * (double)scale + * (double)esScale * (double)plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, (dev->dev_rect.r_ybot + plist->parm_offset) * scale * esScale * 1.0E-6); @@ -1409,7 +1409,7 @@ spcnodeHierVisit(hc, node, res, cap) hierName = (HierName *) node->efnode_name->efnn_hier; nsn = nodeSpiceHierName(hc, hierName); - if (esFormat == SPICE2 || esFormat == HSPICE && !strncmp(nsn, "z@", 2)) { + if (esFormat == SPICE2 || (esFormat == HSPICE && !strncmp(nsn, "z@", 2))) { static char ntmp[MAX_STR_SIZE]; EFHNSprintf(ntmp, hierName); @@ -1816,8 +1816,8 @@ esMakePorts(hc, cdata) /* matches a use. If not, then check if the part */ /* the last opening bracket matches a known use. */ - aptr = strrchr(portname, '['); *tptr = '\0'; + aptr = strrchr(portname, '['); is_array = FALSE; if (aptr != NULL) { @@ -1874,11 +1874,13 @@ esMakePorts(hc, cdata) { nn->efnn_node->efnode_flags |= EF_PORT; nn->efnn_port = -1; // Will be sorted later - } - // Diagnostic - // TxPrintf("Port connection in %s from net %s to net %s (%s)\n", - // def->def_name, locname, name, portname); + // Diagnostic + /* TxPrintf("Port connection in %s from net %s to " + * "net %s (%s)\n", + * def->def_name, locname, name, portname); + */ + } } /* Propagate the EF_SUBS_PORT flag */ diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index 6ae81ed1..06d06900 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -17,8 +17,10 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include /* for atof() */ #include +#include #include #include /* for fabs() */ @@ -168,8 +170,8 @@ esFormatSubs(outf, suf) if (outf) { l = strlen(suf) - 1; - if ((EFOutputFlags & EF_TRIMGLOB ) && suf[l] == '!' || - (EFOutputFlags & EF_TRIMLOCAL) && suf[l] == '#') + if (((EFOutputFlags & EF_TRIMGLOB ) && suf[l] == '!') || + ((EFOutputFlags & EF_TRIMLOCAL) && suf[l] == '#')) suf[l] = '\0' ; if (EFOutputFlags & EF_CONVERTCOMMA) while ((specchar = strchr(suf, ',')) != NULL) @@ -840,7 +842,7 @@ runexttospice: inName = EFArgs(argc, argv, &err_result, spcParseArgs, (ClientData) NULL); if (err_result == TRUE) { - EFDone(); + EFDone(NULL); return; } @@ -878,7 +880,7 @@ runexttospice: if (EFReadFile(inName, esDoHierarchy, esDoExtResis, FALSE, TRUE) == FALSE) { - EFDone(); + EFDone(NULL); return; } @@ -894,7 +896,7 @@ runexttospice: #else TxError("exttospice: Unable to open file %s for writing\n", spcesOutName); #endif - EFDone(); + EFDone(NULL); return; } @@ -1587,7 +1589,7 @@ subcktVisit(use, hierName, is_top) /* generated during topVisit(). */ HashStartSearch(&hs); - while (he = HashNext(&def->def_nodes, &hs)) + while ((he = HashNext(&def->def_nodes, &hs))) { sname = (EFNodeName *) HashGetValue(he); if (sname == NULL) continue; @@ -1618,7 +1620,7 @@ subcktVisit(use, hierName, is_top) nodeList[portidx] = (EFNodeName *)NULL; HashStartSearch(&hs); - while (he = HashNext(&def->def_nodes, &hs)) + while ((he = HashNext(&def->def_nodes, &hs))) { sname = (EFNodeName *) HashGetValue(he); if (sname == NULL) continue; @@ -1809,13 +1811,16 @@ topVisit(def, doStub) HashStartSearch(&hs); portmax = -1; - while (he = HashNext(&def->def_nodes, &hs)) + while ((he = HashNext(&def->def_nodes, &hs))) { sname = (EFNodeName *) HashGetValue(he); if (sname == NULL) continue; snode = sname->efnn_node; if ((!snode) || (!(snode->efnode_flags & EF_PORT))) continue; explicit = FALSE; + portorder = snode->efnode_name->efnn_port; + if (portorder > portmax) portmax = portorder; + if (portorder != -1) explicit = TRUE; for (nodeName = sname; nodeName != NULL; nodeName = nodeName->efnn_next) { portorder = nodeName->efnn_port; @@ -1855,7 +1860,7 @@ topVisit(def, doStub) sorted_ports[portorder] = NULL; HashStartSearch(&hs); - while (he = HashNext(&def->def_nodes, &hs)) + while ((he = HashNext(&def->def_nodes, &hs))) { char stmp[MAX_STR_SIZE]; int portidx; @@ -2007,8 +2012,8 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", parmval * scale * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", parmval * scale * scale - * esScale * esScale * plist->parm_scale + fprintf(esSpiceF, "%g", (double)parmval * (double)scale * (double)scale + * (double)esScale * (double)esScale * plist->parm_scale * 1E-12); else esSIvalue(esSpiceF, 1.0E-12 * (parmval + plist->parm_offset) @@ -2074,7 +2079,7 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", parmval * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", parmval * scale + fprintf(esSpiceF, "%g", (double)parmval * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, 1.0E-12 * (parmval + plist->parm_offset) @@ -2138,7 +2143,7 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", l * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", l * scale * esScale + fprintf(esSpiceF, "%g", (double)l * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, 1.0E-6 * (l + plist->parm_offset) @@ -2162,7 +2167,7 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", dval * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", dval * scale * esScale + fprintf(esSpiceF, "%g", (double)dval * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, (dval + plist->parm_offset) @@ -2180,7 +2185,7 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", w * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", w * scale * esScale + fprintf(esSpiceF, "%g", (double)w * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, 1.0E-6 * (w + plist->parm_offset) @@ -2197,7 +2202,7 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", dev->dev_rect.r_xbot * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", dev->dev_rect.r_xbot * scale + fprintf(esSpiceF, "%g", (double)dev->dev_rect.r_xbot * scale * esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, (dev->dev_rect.r_xbot + plist->parm_offset) @@ -2208,8 +2213,8 @@ spcWriteParams(dev, hierName, scale, l, w, sdM) if (esScale < 0) fprintf(esSpiceF, "%g", dev->dev_rect.r_ybot * scale); else if (plist->parm_scale != 1.0) - fprintf(esSpiceF, "%g", dev->dev_rect.r_ybot * scale - * esScale * plist->parm_scale * 1E-6); + fprintf(esSpiceF, "%g", (double)dev->dev_rect.r_ybot * (double)scale + * (double)esScale * plist->parm_scale * 1E-6); else esSIvalue(esSpiceF, (dev->dev_rect.r_ybot + plist->parm_offset) * scale * esScale * 1.0E-6); @@ -3648,7 +3653,7 @@ spcnodeVisit(node, res, cap) hierName = (HierName *) node->efnode_name->efnn_hier; nsn = nodeSpiceName(hierName, NULL); - if (esFormat == SPICE2 || esFormat == HSPICE && strncmp(nsn, "z@", 2)==0 ) { + if (esFormat == SPICE2 || (esFormat == HSPICE && strncmp(nsn, "z@", 2)==0 )) { static char ntmp[MAX_STR_SIZE]; EFHNSprintf(ntmp, hierName); @@ -3696,7 +3701,7 @@ nodeVisitDebug(node, res, cap) hierName = (HierName *) node->efnode_name->efnn_hier; nsn = nodeSpiceName(hierName, NULL); - TxError("** %s (%x)\n", nsn, node); + TxError("** %s (%lx)\n", nsn, (intmax_t) node); printf("\t client.name=%s, client.m_w=%p\n", ((nodeClient *)node->efnode_client)->spiceNodeName, @@ -3801,7 +3806,7 @@ EFHNSprintf(str, hierName) convertComma = (EFOutputFlags & EF_CONVERTCOMMA); convertEqual = (EFOutputFlags & EF_CONVERTEQUAL); convertBrackets = (EFOutputFlags & EF_CONVERTBRACKETS); - while (c = *cp++) + while ((c = *cp++)) { switch (c) { diff --git a/extcheck/extcheck.c b/extcheck/extcheck.c index 5a71cf5b..07550b50 100644 --- a/extcheck/extcheck.c +++ b/extcheck/extcheck.c @@ -90,7 +90,7 @@ main(argc, argv) #ifdef free_all_mem EFFlatDone(NULL); - EFDone(); + EFDone(NULL); #endif /* free_all_mem */ printf("Memory used: %s\n", RunStats(RS_MEM, NULL, NULL)); diff --git a/extflat/EFantenna.c b/extflat/EFantenna.c index c0a9725e..3ee40a24 100644 --- a/extflat/EFantenna.c +++ b/extflat/EFantenna.c @@ -197,7 +197,7 @@ runantennacheck: if (err_result == TRUE) { - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } @@ -211,7 +211,7 @@ runantennacheck: if (w == (MagWindow *) NULL) { TxError("Point to a window or specify a cell name.\n"); - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } inName = ((CellUse *) w->w_surfaceID)->cu_def->cd_name; @@ -226,7 +226,7 @@ runantennacheck: TxPrintf("Reading extract file.\n"); if (EFReadFile(inName, FALSE, FALSE, FALSE, FALSE) == FALSE) { - EFDone(); + EFDone(NULL); return /* TCL_ERROR */; } @@ -257,7 +257,7 @@ runantennacheck: TxPrintf("Running antenna checks.\n"); EFVisitDevs(antennacheckVisit, (ClientData)editUse); EFFlatDone(NULL); - EFDone(); + EFDone(NULL); TxPrintf("antennacheck finished.\n"); freeMagic(EFDeviceTypes); diff --git a/extflat/EFbuild.c b/extflat/EFbuild.c index 684f2895..902058d7 100644 --- a/extflat/EFbuild.c +++ b/extflat/EFbuild.c @@ -24,6 +24,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header$"; #include #include /* for atof() */ #include +#include #include "utils/magic.h" #include "utils/geometry.h" @@ -463,7 +464,7 @@ efBuildDist(def, driver, receiver, min, max) #endif /* notdef */ he = HashFind(&def->def_dists, (char *) &distKey); - if (dist = (Distance *) HashGetValue(he)) + if ((dist = (Distance *) HashGetValue(he))) { /* * There was already an entry in the table; update it @@ -659,7 +660,7 @@ efBuildEquiv(def, nodeName1, nodeName2, resist, isspice) * node that was just removed. */ HashStartSearch(&hs); - while (he = HashNext(&def->def_devs, &hs)) + while ((he = HashNext(&def->def_devs, &hs))) { Dev *dev; int n; @@ -679,7 +680,7 @@ efBuildEquiv(def, nodeName1, nodeName2, resist, isspice) { nn2->efnn_refc += nn1->efnn_refc + 1; HashStartSearch(&hs); - while (he1 = HashNext(&def->def_nodes, &hs)) + while ((he1 = HashNext(&def->def_nodes, &hs))) if ((EFNodeName *)HashGetValue(he1) == nn1) HashSetValue(he1, (char *)nn2); } @@ -687,7 +688,7 @@ efBuildEquiv(def, nodeName1, nodeName2, resist, isspice) { nn1->efnn_refc += nn2->efnn_refc + 1; HashStartSearch(&hs); - while (he2 = HashNext(&def->def_nodes, &hs)) + while ((he2 = HashNext(&def->def_nodes, &hs))) if ((EFNodeName *)HashGetValue(he2) == nn2) HashSetValue(he2, (char *)nn1); } @@ -1045,7 +1046,7 @@ efBuildDevice(def, class, type, r, argc, argv) && (ttype != extGetDevType(EFDevTypes[newdev->dev_type])))) { TxError("Device %s %s at (%d, %d) overlaps incompatible device %s %s!\n", - extDevTable[class], type, r->r_xbot, r->r_ybot, + extDevTable[(unsigned char)class], type, r->r_xbot, r->r_ybot, extDevTable[newdev->dev_class], EFDevTypes[newdev->dev_type]); return 0; } @@ -1053,7 +1054,7 @@ efBuildDevice(def, class, type, r, argc, argv) { TxError("Device %s %s at (%d, %d) overlaps device with incompatible" " number of terminals (%d vs. %d)!\n", - extDevTable[class], type, r->r_xbot, r->r_ybot, nterminals, + extDevTable[(unsigned char)class], type, r->r_xbot, r->r_ybot, nterminals, newdev->dev_nterm); return 0; } @@ -1757,7 +1758,7 @@ again: *dstp++ = ']'; /* Copy remainder of path */ - while (*dstp++ = *cp++) + while ((*dstp++ = *cp++)) /* Nothing */; cnp->cn_name = StrDup((char **) NULL, newname); @@ -1970,7 +1971,7 @@ efNodeMerge(node1ptr, node2ptr) keeping->efnode_num += removing->efnode_num; /* Merge attribute lists */ - if (ap = removing->efnode_attrs) + if ((ap = removing->efnode_attrs)) { while (ap->efa_next) ap = ap->efa_next; @@ -2059,8 +2060,8 @@ efFreeUseTable(table) EFNodeName *nn; HashStartSearch(&hs); - while (he = HashNext(table, &hs)) - if (use = (Use *) HashGetValue(he)) + while ((he = HashNext(table, &hs))) + if ((use = (Use *) HashGetValue(he))) { if (use->use_id != NULL) freeMagic((char *)use->use_id); freeMagic(use); @@ -2088,7 +2089,7 @@ efFreeDevTable(table) int n; HashStartSearch(&hs); - while (he = HashNext(table, &hs)) + while ((he = HashNext(table, &hs))) { dev = (Dev *)HashGetValue(he); for (n = 0; n < (int)dev->dev_nterm; n++) @@ -2131,8 +2132,8 @@ efFreeNodeTable(table) EFNodeName *nn; HashStartSearch(&hs); - while (he = HashNext(table, &hs)) - if (nn = (EFNodeName *) HashGetValue(he)) + while ((he = HashNext(table, &hs))) + if ((nn = (EFNodeName *) HashGetValue(he))) { for (hn = nn->efnn_hier; hn; hn = hn->hn_parent) (void) HashFind(&efFreeHashTable, (char *) hn); diff --git a/extflat/EFdef.c b/extflat/EFdef.c index 1947c82c..6eb24b9b 100644 --- a/extflat/EFdef.c +++ b/extflat/EFdef.c @@ -107,7 +107,7 @@ EFDone(func) int n; HashStartSearch(&hs); - while (he = HashNext(&efDefHashTable, &hs)) + while ((he = HashNext(&efDefHashTable, &hs))) { def = (Def *) HashGetValue(he); freeMagic(def->def_name); @@ -151,7 +151,7 @@ EFDone(func) /* Free up the parameter name tables for each device */ HashStartSearch(&hs); - while (he = HashNext(&efDevParamTable, &hs)) + while ((he = HashNext(&efDevParamTable, &hs))) { DevParam *plist = (DevParam *)HashGetValue(he); while (plist != NULL) @@ -164,7 +164,7 @@ EFDone(func) HashKill(&efDevParamTable); HashStartSearch(&hs); - while (he = HashNext(&efFreeHashTable, &hs)) + while ((he = HashNext(&efFreeHashTable, &hs))) { /* Keys of this table are entries to be free'd */ freeMagic(he->h_key.h_ptr); diff --git a/extflat/EFflat.c b/extflat/EFflat.c index 6e253af8..25502dbe 100644 --- a/extflat/EFflat.c +++ b/extflat/EFflat.c @@ -543,7 +543,7 @@ efAddNodes(hc, stdcell) * The name should only have been in the hash table already * if the node was marked with EF_DEVTERM as described above. */ - if (oldname = (EFNodeName *) HashGetValue(he)) + if ((oldname = (EFNodeName *) HashGetValue(he))) { if (hierName != nn->efnn_hier) EFHNFree(hierName, hc->hc_hierName, HN_CONCAT); @@ -795,7 +795,7 @@ efFlatGlob() * also adding it to the global hash table efNodeHashTable. */ HashStartSearch(&hs); - while (heGlob = HashNext(&globalTable, &hs)) + while ((heGlob = HashNext(&globalTable, &hs))) { /* * Add the name to the flat node name hash table, and @@ -927,7 +927,7 @@ efFlatKills(hc) /* Process all of our kill information */ for (k = def->def_kills; k; k = k->kill_next) { - if (he = EFHNConcatLook(hc->hc_hierName, k->kill_name, "kill")) + if ((he = EFHNConcatLook(hc->hc_hierName, k->kill_name, "kill"))) { nn = (EFNodeName *) HashGetValue(he); nn->efnn_node->efnode_flags |= EF_KILLED; @@ -1149,12 +1149,12 @@ efFlatDists(hc) /* Process our own distances */ HashStartSearch(&hs); - while (he = HashNext(&hc->hc_use->use_def->def_dists, &hs)) + while ((he = HashNext(&hc->hc_use->use_def->def_dists, &hs))) { dist = (Distance *) HashGetValue(he); efHNBuildDistKey(hc->hc_hierName, dist, &distKey); heFlat = HashFind(&efDistHashTable, (char *) &distKey); - if (distFlat = (Distance *) HashGetValue(heFlat)) + if ((distFlat = (Distance *) HashGetValue(heFlat))) { /* * This code differs from that in efBuildDist(), in that diff --git a/extflat/EFhier.c b/extflat/EFhier.c index d295437c..efc6cc38 100644 --- a/extflat/EFhier.c +++ b/extflat/EFhier.c @@ -81,7 +81,7 @@ efHierSrUses(hc, func, cdata) HashEntry *he; HashStartSearch(&hs); - while (he = HashNext(&hc->hc_use->use_def->def_uses, &hs)) + while ((he = HashNext(&hc->hc_use->use_def->def_uses, &hs))) { u = (Use *)HashGetValue(he); newhc.hc_use = u; @@ -258,7 +258,7 @@ EFHierSrDefs(hc, func, cdata) } HashStartSearch(&hs); - while (he = HashNext(&hc->hc_use->use_def->def_uses, &hs)) + while ((he = HashNext(&hc->hc_use->use_def->def_uses, &hs))) { u = (Use *)HashGetValue(he); newhc.hc_use = u; @@ -486,7 +486,7 @@ efHierVisitDevs(hc, ca) /* Visit all devices */ HashStartSearch(&hs); - while (he = HashNext(&def->def_devs, &hs)) + while ((he = HashNext(&def->def_devs, &hs))) { dev = (Dev *)HashGetValue(he); if (efHierDevKilled(hc, dev, hc->hc_hierName)) @@ -679,7 +679,7 @@ EFHierVisitCaps(hc, capProc, cdata) /* efCapHashTable using efFlatCaps(). */ HashStartSearch(&hs); - while (he = HashNext(&efCapHashTable, &hs)) + while ((he = HashNext(&efCapHashTable, &hs))) { ccap = CapHashGetValue(he); ck = (EFCoupleKey *) he->h_key.h_words; diff --git a/extflat/EFname.c b/extflat/EFname.c index 5a5302ec..a8ff4256 100644 --- a/extflat/EFname.c +++ b/extflat/EFname.c @@ -322,7 +322,7 @@ efHNToStrFunc(hierName, dstp) } srcp = hierName->hn_name; - while (*dstp++ = *srcp++) + while ((*dstp++ = *srcp++)) /* Nothing */; return --dstp; @@ -581,7 +581,7 @@ efHNLexOrder(hierName1, hierName2) return 0; if (hierName1->hn_parent) - if (i = efHNLexOrder(hierName1->hn_parent, hierName2->hn_parent)) + if ((i = efHNLexOrder(hierName1->hn_parent, hierName2->hn_parent))) return i; return strcmp(hierName1->hn_name, hierName2->hn_name); @@ -629,7 +629,7 @@ efHNFromUse(hc, prefix) namePtr = name; srcp = u->use_id; dstp = name; - while (*dstp++ = *srcp++) + while ((*dstp++ = *srcp++)) /* Nothing */; /* Array subscript */ @@ -762,7 +762,7 @@ efHNInit(hierName, cp, endp) } else { - while (*dstp++ = *cp) + while ((*dstp++ = *cp)) hashsum = HASHADDVAL(hashsum, *cp++); } @@ -974,7 +974,7 @@ efHNDump() } HashStartSearch(&hs); - while (he = HashNext(&efNodeHashTable, &hs)) + while ((he = HashNext(&efNodeHashTable, &hs))) fprintf(f, "%s\n", EFHNToStr((HierName *) he->h_key.h_ptr)); (void) fclose(f); diff --git a/extflat/EFread.c b/extflat/EFread.c index 0d472350..29742c72 100644 --- a/extflat/EFread.c +++ b/extflat/EFread.c @@ -71,32 +71,32 @@ static struct } keyTable[] = { - "abstract", ABSTRACT, 0, /* defines a LEF-like view */ - "adjust", ADJUST, 4, - "attr", ATTR, 8, - "cap", CAP, 4, - "device", DEVICE, 11, /* effectively replaces "fet" */ - "distance", DIST, 4, - "equiv", EQUIV, 3, - "fet", FET, 12, /* for backwards compatibility */ - "killnode", KILLNODE, 2, - "merge", MERGE, 3, - "node", NODE, 7, - "parameters", PARAMETERS, 3, - "port", PORT, 8, - "primitive", PRIMITIVE, 0, /* defines a primitive device */ - "resist", RESISTOR, 4, - "resistclasses", RESISTCLASS, 1, - "rnode", RNODE, 5, - "scale", SCALE, 4, - "subcap", SUBCAP, 3, - "substrate", SUBSTRATE, 3, - "tech", TECH, 2, - "timestamp", TIMESTAMP, 2, - "use", USE, 9, - "version", VERSION, 2, - "style", EXT_STYLE, 2, - 0 + {"abstract", ABSTRACT, 0}, /* defines a LEF-like view */ + {"adjust", ADJUST, 4}, + {"attr", ATTR, 8}, + {"cap", CAP, 4}, + {"device", DEVICE, 11}, /* effectively replaces "fet" */ + {"distance", DIST, 4}, + {"equiv", EQUIV, 3}, + {"fet", FET, 12}, /* for backwards compatibility */ + {"killnode", KILLNODE, 2}, + {"merge", MERGE, 3}, + {"node", NODE, 7}, + {"parameters", PARAMETERS, 3}, + {"port", PORT, 8}, + {"primitive", PRIMITIVE, 0}, /* defines a primitive device */ + {"resist", RESISTOR, 4}, + {"resistclasses", RESISTCLASS, 1}, + {"rnode", RNODE, 5}, + {"scale", SCALE, 4}, + {"subcap", SUBCAP, 3}, + {"substrate", SUBSTRATE, 3}, + {"tech", TECH, 2}, + {"timestamp", TIMESTAMP, 2}, + {"use", USE, 9}, + {"version", VERSION, 2}, + {"style", EXT_STYLE, 2}, + {0} }; /* Data shared with EFerror.c */ @@ -670,7 +670,7 @@ resistChanged: /* Read in each def that has not yet been read in */ HashStartSearch(&hs); - while (he = HashNext(&def->def_uses, &hs)) + while ((he = HashNext(&def->def_uses, &hs))) { use = (Use *)HashGetValue(he); if ((use->use_def->def_flags & DEF_AVAILABLE) == 0) diff --git a/extflat/EFsym.c b/extflat/EFsym.c index d3aae30c..3aeaceba 100644 --- a/extflat/EFsym.c +++ b/extflat/EFsym.c @@ -110,7 +110,7 @@ efSymAddFile(name) for (lineNum = 1; fgets(line, sizeof line, f); lineNum++) { - if (cp = strchr(line, '\n')) + if ((cp = strchr(line, '\n'))) *cp = '\0'; if (!efSymAdd(line)) TxError("Error at line %d of %s\n", lineNum, name); @@ -161,7 +161,7 @@ efSymAdd(str) } value[-1] = '\0'; - if (he = HashLookOnly(&efSymHash, str)) + if ((he = HashLookOnly(&efSymHash, str))) { TxError("Symbol \"%s\" already defined\n", str); value[-1] = '='; diff --git a/extflat/EFvisit.c b/extflat/EFvisit.c index e28b7135..a57356a8 100644 --- a/extflat/EFvisit.c +++ b/extflat/EFvisit.c @@ -319,7 +319,7 @@ efVisitDevs(hc, ca) /* Visit our own devices */ HashStartSearch(&hs); - while (he = HashNext(&def->def_devs, &hs)) + while ((he = HashNext(&def->def_devs, &hs))) { dev = (Dev *)HashGetValue(he); if (efDevKilled(dev, hc->hc_hierName)) @@ -624,7 +624,7 @@ EFVisitCaps(capProc, cdata) EFCapValue cap; HashStartSearch(&hs); - while (he = HashNext(&efCapHashTable, &hs)) + while ((he = HashNext(&efCapHashTable, &hs))) { cap = CapHashGetValue(he); ck = (EFCoupleKey *) he->h_key.h_words; @@ -789,7 +789,7 @@ EFNodeResist(node) if (v < 0.0) s = 0.0; else s = sqrt(v); fperim = (float) perim; - dresist = (fperim + s)/(fperim - s) * efResists[n]; + dresist = ((double)fperim + (double)s)/((double)fperim - (double)s) * efResists[n]; if (dresist + (double) resist > (double) INT_MAX) resist = INT_MAX; else @@ -878,7 +878,7 @@ EFHNOut(hierName, outf) trimLocal = (EFOutputFlags & EF_TRIMLOCAL); convComma = (EFOutputFlags & EF_CONVERTCOMMA); convBrackets = (EFOutputFlags & EF_CONVERTBRACKETS); - while (c = *cp++) + while ((c = *cp++)) { if (*cp) { @@ -894,9 +894,16 @@ EFHNOut(hierName, outf) } else switch (c) { - case '!': if (!trimGlob) (void) putc(c, outf); break; - case '#': if (trimLocal) break; - default: (void) putc(c, outf); break; + case '!': + if (!trimGlob) + (void) putc(c, outf); + break; + case '#': + if (trimLocal) + break; + default: + (void) putc(c, outf); + break; } } } @@ -914,7 +921,7 @@ efHNOutPrefix(hierName, outf) efHNOutPrefix(hierName->hn_parent, outf); cp = hierName->hn_name; - while (c = *cp++) + while ((c = *cp++)) putc(c, outf); putc('/', outf); } diff --git a/extract/ExtArray.c b/extract/ExtArray.c index 2ea8b6ea..b1f9f43f 100644 --- a/extract/ExtArray.c +++ b/extract/ExtArray.c @@ -690,7 +690,7 @@ extArrayAdjust(ha, et1, et2) extHierAdjustments(ha, &ha->ha_cumFlat, et2, et2); HashStartSearch(&hs); - while (he = HashNext(&ha->ha_cumFlat.et_coupleHash, &hs)) + while ((he = HashNext(&ha->ha_cumFlat.et_coupleHash, &hs))) { cap = extGetCapValue(he) / ExtCurStyle->exts_capScale; if (cap == 0) @@ -797,7 +797,7 @@ extArrayTileToNode(tp, pNum, et, ha, doHard) } if (!DebugIsSet(extDebugID, extDebNoHard)) - if (reg = (LabRegion *) extArrayHardNode(tp, pNum, def, ha)) + if ((reg = (LabRegion *) extArrayHardNode(tp, pNum, def, ha))) goto found; /* Blew it */ diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index 0f45ce3e..903b5866 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -389,7 +389,7 @@ extBasic(def, outFile) if (propfound) { token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &llx)) + if ((token == NULL) || (sscanf(token, "%d", &llx) != 1)) propfound = FALSE; else llx *= ExtCurStyle->exts_unitsPerLambda; @@ -397,7 +397,7 @@ extBasic(def, outFile) if (propfound) { token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &lly)) + if ((token == NULL) || (sscanf(token, "%d", &lly) != 1)) propfound = FALSE; else lly *= ExtCurStyle->exts_unitsPerLambda; @@ -405,20 +405,24 @@ extBasic(def, outFile) if (propfound) { token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &urx)) + if ((token == NULL) || (sscanf(token, "%d", &urx) != 1)) propfound = FALSE; else + { urx *= ExtCurStyle->exts_unitsPerLambda; - if (urx <= llx) urx++; + if (urx <= llx) urx++; + } } if (propfound) { token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &ury)) + if ((token == NULL) || (sscanf(token, "%d", &ury) != 1)) propfound = FALSE; else + { ury *= ExtCurStyle->exts_unitsPerLambda; - if (ury <= lly) ury++; + if (ury <= lly) ury++; + } } if (propfound) { @@ -427,14 +431,14 @@ extBasic(def, outFile) case DEV_FET: /* Read area */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &w)) + if ((token == NULL) || (sscanf(token, "%d", &w) != 1)) propfound = FALSE; else w *= ExtCurStyle->exts_unitsPerLambda * ExtCurStyle->exts_unitsPerLambda; /* Read perimeter */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &l)) + if ((token == NULL) || (sscanf(token, "%d", &l) != 1)) propfound = FALSE; else l *= ExtCurStyle->exts_unitsPerLambda; @@ -444,13 +448,13 @@ extBasic(def, outFile) case DEV_BJT: /* Read width */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &w)) + if ((token == NULL) || (sscanf(token, "%d", &w) != 1)) propfound = FALSE; else w *= ExtCurStyle->exts_unitsPerLambda; /* Read length */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &l)) + if ((token == NULL) || (sscanf(token, "%d", &l) != 1)) propfound = FALSE; else l *= ExtCurStyle->exts_unitsPerLambda; @@ -460,13 +464,13 @@ extBasic(def, outFile) { /* Read width */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &w)) + if ((token == NULL) || (sscanf(token, "%d", &w) != 1)) propfound = FALSE; else w *= ExtCurStyle->exts_unitsPerLambda; /* Read length */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &l)) + if ((token == NULL) || (sscanf(token, "%d", &l) != 1)) propfound = FALSE; else l *= ExtCurStyle->exts_unitsPerLambda; @@ -479,14 +483,14 @@ extBasic(def, outFile) { /* Read area */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &w)) + if ((token == NULL) || (sscanf(token, "%d", &w) != 1)) propfound = FALSE; else w *= ExtCurStyle->exts_unitsPerLambda * ExtCurStyle->exts_unitsPerLambda; /* Read perimeter */ token = strtok(NULL, " "); - if ((token == NULL) || !sscanf(token, "%d", &l)) + if ((token == NULL) || (sscanf(token, "%d", &l) != 1)) propfound = FALSE; else l *= ExtCurStyle->exts_unitsPerLambda; @@ -612,7 +616,7 @@ extSetResist(reg) reg->nreg_pa[n].pa_perim = perim = extResistPerim[n]; if (area > 0 && perim > 0) { - v = (double) (perim*perim - 16*area); + v = (double) ((dlong)perim * perim - 16 * area); /* Approximate by one square if v < 0 */ if (v < 0) s = 0; else s = sqrt(v); @@ -1022,7 +1026,7 @@ extFindDuplicateLabels(def, nreg) { r.r_ll = r.r_ur = ll2->ll_label->lab_rect.r_ll; r.r_xbot--, r.r_ybot--, r.r_xtop++, r.r_ytop++; - extMakeNodeNumPrint(name, np2); + extMakeNodeNumPrint(name, (LabRegion *)np2); (void) sprintf(message, badmesg, text, name); DBWFeedbackAdd(&r, message, def, 1, STYLE_PALEHIGHLIGHTS); @@ -1078,15 +1082,15 @@ ExtSortTerminals(tran, ll) { p1 = &(tran->tr_termpos[nsd]); p2 = &(tran->tr_termpos[nsd+1]); - if( p2->pnum > p1->pnum ) + if (p2->pnum > p1->pnum) continue; - else if( p2->pnum == p1->pnum ) + else if (p2->pnum == p1->pnum) { - if( p2->pt.p_x > p1->pt.p_x ) + if (p2->pt.p_x > p1->pt.p_x) continue; - else if( p2->pt.p_x == p1->pt.p_x && p2->pt.p_y > p1->pt.p_y ) + else if (p2->pt.p_x == p1->pt.p_x && p2->pt.p_y > p1->pt.p_y) continue; - else if( p2->pt.p_x == p1->pt.p_x && p2->pt.p_y == p1->pt.p_y ) + else if (p2->pt.p_x == p1->pt.p_x && p2->pt.p_y == p1->pt.p_y) { TxPrintf("Extract error: Duplicate tile position, ignoring\n"); continue; @@ -2288,7 +2292,7 @@ extOutputDevices(def, transList, outFile) if (!TTMaskIsZero(&devptr->exts_deviceSubstrateTypes) && (subsNode = extTransRec.tr_subsnode)) { - subsName = extNodeName(subsNode); + subsName = extNodeName((LabRegion *)subsNode); } #ifdef MAGIC_WRAPPER @@ -2332,11 +2336,11 @@ extOutputDevices(def, transList, outFile) /* gate */ node = (NodeRegion *)extGetRegion(reg->treg_tile); - fprintf(outFile, "\"%s\" ", extNodeName(node)); + fprintf(outFile, "\"%s\" ", extNodeName((LabRegion *)node)); /* First non-gate terminal */ node = (NodeRegion *)extTransRec.tr_termnode[0]; - fprintf(outFile, "\"%s\"\n", extNodeName(node)); + fprintf(outFile, "\"%s\"\n", extNodeName((LabRegion *)node)); continue; } @@ -2355,7 +2359,7 @@ extOutputDevices(def, transList, outFile) { case DEV_FET: /* old style, perimeter & area */ fprintf(outFile, "%s %s", - extDevTable[devptr->exts_deviceClass], + extDevTable[(unsigned char)devptr->exts_deviceClass], devptr->exts_deviceName); fprintf(outFile, " %d %d %d %d", @@ -2490,7 +2494,7 @@ extOutputDevices(def, transList, outFile) devptr = extDevFindParamMatch(devptr, length, width); fprintf(outFile, "%s %s", - extDevTable[devptr->exts_deviceClass], + extDevTable[(unsigned char)devptr->exts_deviceClass], devptr->exts_deviceName); fprintf(outFile, " %d %d %d %d", @@ -2516,7 +2520,7 @@ extOutputDevices(def, transList, outFile) case DEV_PDIODE: devptr = extDevFindParamMatch(devptr, length, width); fprintf(outFile, "%s %s", - extDevTable[devptr->exts_deviceClass], + extDevTable[(unsigned char)devptr->exts_deviceClass], devptr->exts_deviceName); fprintf(outFile, " %d %d %d %d", @@ -2641,7 +2645,7 @@ extOutputDevices(def, transList, outFile) devptr = extDevFindParamMatch(devptr, length, width); fprintf(outFile, "%s %s", - extDevTable[devptr->exts_deviceClass], + extDevTable[(unsigned char)devptr->exts_deviceClass], devptr->exts_deviceName); fprintf(outFile, " %d %d %d %d", @@ -2675,7 +2679,7 @@ extOutputDevices(def, transList, outFile) case DEV_CAPREV: case DEV_CSUBCKT: fprintf(outFile, "%s %s", - extDevTable[devptr->exts_deviceClass], + extDevTable[(unsigned char)devptr->exts_deviceClass], devptr->exts_deviceName); fprintf(outFile, " %d %d %d %d", @@ -2879,7 +2883,7 @@ extTransFindSubsFunc1(tile, noderecptr) if (tile->ti_client != (ClientData) extUnInit) { if ((noderecptr->region != (NodeRegion *)NULL) && - (noderecptr->region != tile->ti_client)) + ((ClientData)noderecptr->region != tile->ti_client)) TxError("Warning: Split substrate under device at (%d %d)\n", tile->ti_ll.p_x, tile->ti_ll.p_y); if (IsSplit(tile)) @@ -3476,17 +3480,17 @@ extTransPerimFunc(bp) /* update the region tile position */ - if( DBPlane(TiGetType(otile)) < pos->pnum ) + if (DBPlane(TiGetType(otile)) < pos->pnum) { pos->pnum = DBPlane(TiGetType(otile)); pos->pt = otile->ti_ll; } - else if( DBPlane(TiGetType(otile)) == pos->pnum ) + else if (DBPlane(TiGetType(otile)) == pos->pnum) { - if( LEFT(otile) < pos->pt.p_x ) + if (LEFT(otile) < pos->pt.p_x) pos->pt = otile->ti_ll; - else if( LEFT(otile) == pos->pt.p_x && - BOTTOM(otile) < pos->pt.p_y ) + else if (LEFT(otile) == pos->pt.p_x && + BOTTOM(otile) < pos->pt.p_y) pos->pt.p_y = BOTTOM(otile); } } @@ -4566,7 +4570,7 @@ extNodeAreaFunc(tile, arg) } /* Compute the resistance for the previous region */ - if (old = (NodeRegion *) arg->fra_region) + if ((old = (NodeRegion *) arg->fra_region)) if (ExtOptions & EXT_DORESISTANCE) extSetResist(old); @@ -4946,7 +4950,7 @@ donesides: * 1-lambda halo to find everything it overlaps or touches * on the other plane. */ - if (pMask = DBAllConnPlanes[type]) + if ((pMask = DBAllConnPlanes[type])) { Rect biggerArea; bool is_split = IsSplit(tile); @@ -5029,7 +5033,7 @@ extCapHashKill(ht) HashEntry *he; HashStartSearch(&hs); - while (he = HashNext(ht, &hs)) + while ((he = HashNext(ht, &hs))) { if (HashGetValue(he) != NULL) { diff --git a/extract/ExtCell.c b/extract/ExtCell.c index 48d33751..d425c4d4 100644 --- a/extract/ExtCell.c +++ b/extract/ExtCell.c @@ -215,7 +215,7 @@ extFileOpen(def, file, mode, prealfile) name = def->cd_file; ends = strrchr(def->cd_file, '/'); if (ends == NULL) ends = def->cd_file; - if (endp = strrchr(ends + 1, '.')) + if ((endp = strrchr(ends + 1, '.'))) { name = namebuf; len = endp - def->cd_file; diff --git a/extract/ExtCouple.c b/extract/ExtCouple.c index bffe1893..9b669248 100644 --- a/extract/ExtCouple.c +++ b/extract/ExtCouple.c @@ -219,7 +219,7 @@ extRelocateSubstrateCoupling(table, subsnode) NodeRegion *rbp; HashStartSearch(&hs); - while (he = HashNext(table, &hs)) + while ((he = HashNext(table, &hs))) { cap = extGetCapValue(he); if (cap == 0) continue; @@ -275,7 +275,7 @@ extOutputCoupling(table, outFile) CapValue cap; /* value of capacitance. */ HashStartSearch(&hs); - while (he = HashNext(table, &hs)) + while ((he = HashNext(table, &hs))) { cap = extGetCapValue(he) / ExtCurStyle->exts_capScale; if (cap == 0) @@ -464,7 +464,7 @@ extAddOverlap(tbelow, ecpls) * Deduct the area shielded from the area of the overlap, so we adjust * the overlap capacitance correspondingly. */ - if (ov.o_pmask = ExtCurStyle->exts_overlapShieldPlanes[ta][tb]) + if ((ov.o_pmask = ExtCurStyle->exts_overlapShieldPlanes[ta][tb])) { ov.o_tmask = ExtCurStyle->exts_overlapShieldTypes[ta][tb]; for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++) @@ -963,7 +963,7 @@ extRemoveSubcap(bp, clip, esws) if (dnear < 0) dnear = 0; /* Don't count underlap */ mult = ExtCurStyle->exts_overlapMult[ta][0]; - snear = 0.6366 * atan(mult * dnear); + snear = 0.6366 * atan((double)mult * dnear); /* "snear" is the fractional portion of the fringe cap seen by */ /* the substrate, so (1.0 - snear) is the part that is blocked. */ diff --git a/extract/ExtHard.c b/extract/ExtHard.c index 923c2041..8f1fef43 100644 --- a/extract/ExtHard.c +++ b/extract/ExtHard.c @@ -376,7 +376,7 @@ extHardSetLabel(scx, reg, arg) do { *dstp++ = *srcp++; } while (--prefixlen > 0); } srcp = text; - while (*dstp++ = *srcp++) /* Nothing */; + while ((*dstp++ = *srcp++)) /* Nothing */; arg->hw_label = newlab; if (DebugIsSet(extDebugID, extDebHardWay)) @@ -455,7 +455,7 @@ extHardGenerateLabel(scx, reg, arg) do { *dstp++ = *srcp++; } while (--prefixlen > 0); } srcp = gen; - while (*dstp++ = *srcp++) /* Nothing */; + while ((*dstp++ = *srcp++)) /* Nothing */; arg->hw_label = newlab; if (DebugIsSet(extDebugID, extDebHardWay)) TxPrintf("Hard way: generated label = \"%s\"\n", newlab->lab_text); diff --git a/extract/ExtHier.c b/extract/ExtHier.c index 4fc502b7..87d223b8 100644 --- a/extract/ExtHier.c +++ b/extract/ExtHier.c @@ -737,7 +737,7 @@ extHierAdjustments(ha, cumFlat, oneFlat, lookFlat) if (ExtOptions & EXT_DOCOUPLING) { HashStartSearch(&hs); - while (he = HashNext(&oneFlat->et_coupleHash, &hs)) + while ((he = HashNext(&oneFlat->et_coupleHash, &hs))) { ckpOne = ((CoupleKey *) he->h_key.h_words); @@ -828,7 +828,7 @@ extOutputConns(table, outf) HashEntry *he; HashStartSearch(&hs); - while (he = HashNext(table, &hs)) + while ((he = HashNext(table, &hs))) { nfirst = (NodeName *) HashGetValue(he); @@ -838,7 +838,7 @@ extOutputConns(table, outf) * for a node appearing earlier in the table. If so, we need * only free the NodeName without any further processing. */ - if (node = nfirst->nn_node) + if ((node = nfirst->nn_node)) { /* * If there are N names for this node, output N-1 merge lines. @@ -848,13 +848,13 @@ extOutputConns(table, outf) /* Note 3/1/2017: Cap value no longer used */ c = (node->node_cap) / ExtCurStyle->exts_capScale; nn = node->node_names; - if (nnext = nn->nn_next) + if ((nnext = nn->nn_next)) { /* First merge */ fprintf(outf, "merge \"%s\" \"%s\" %lg", nn->nn_name, nnext->nn_name, c); for (n = 0; n < ExtCurStyle->exts_numResistClasses; n++) - fprintf(outf, " %d %d", + fprintf(outf, " %"DLONG_PREFIX"d %d", node->node_pa[n].pa_area, node->node_pa[n].pa_perim); fprintf(outf, "\n"); @@ -862,7 +862,7 @@ extOutputConns(table, outf) nn->nn_node = (Node *) NULL; /* Processed */ /* Subsequent merges */ - for (nn = nnext; nnext = nn->nn_next; nn = nnext) + for (nn = nnext; (nnext = nn->nn_next); nn = nnext) { fprintf(outf, "merge \"%s\" \"%s\"\n", nn->nn_name, nnext->nn_name); diff --git a/extract/ExtLength.c b/extract/ExtLength.c index bfb2ba6f..b896d3e2 100644 --- a/extract/ExtLength.c +++ b/extract/ExtLength.c @@ -261,7 +261,7 @@ extLength(rootUse, f) * be from a single cell. */ HashStartSearch(&hs); - while (he = HashNext(&extDriverHash, &hs)) + while ((he = HashNext(&extDriverHash, &hs))) { dList = extPathLabel(rootUse, he->h_key.h_name); HashSetValue(he, (ClientData) dList); @@ -273,7 +273,7 @@ extLength(rootUse, f) * then compute and output the distance to each. */ HashStartSearch(&hs); - while (he = HashNext(&extDriverHash, &hs)) + while ((he = HashNext(&extDriverHash, &hs))) { /* Ignore drivers whose labels couldn't be found */ dList = (Label *) HashGetValue(he); @@ -875,7 +875,7 @@ extPathFlood(tile, p, distance, epa) * 1-lambda halo to find everything it overlaps or touches * on the other plane. */ - if (pMask = DBAllConnPlanes[type]) + if ((pMask = DBAllConnPlanes[type])) { int saveplane = epa->epa_pNum; struct extPathFloodArg epfa; diff --git a/extract/ExtMain.c b/extract/ExtMain.c index 464cfab7..eac2b5ee 100644 --- a/extract/ExtMain.c +++ b/extract/ExtMain.c @@ -137,23 +137,23 @@ ExtInit() char *di_name; int *di_id; } debugFlags[] = { - "areaenum", &extDebAreaEnum, - "array", &extDebArray, - "hardway", &extDebHardWay, - "hiercap", &extDebHierCap, - "hierareacap", &extDebHierAreaCap, - "label", &extDebLabel, - "length", &extDebLength, - "neighbor", &extDebNeighbor, - "noarray", &extDebNoArray, - "nofeedback", &extDebNoFeedback, - "nohard", &extDebNoHard, - "nosubcell", &extDebNoSubcell, - "perimeter", &extDebPerim, - "resist", &extDebResist, - "visonly", &extDebVisOnly, - "yank", &extDebYank, - 0 + {"areaenum", &extDebAreaEnum}, + {"array", &extDebArray}, + {"hardway", &extDebHardWay}, + {"hiercap", &extDebHierCap}, + {"hierareacap", &extDebHierAreaCap}, + {"label", &extDebLabel}, + {"length", &extDebLength}, + {"neighbor", &extDebNeighbor}, + {"noarray", &extDebNoArray}, + {"nofeedback", &extDebNoFeedback}, + {"nohard", &extDebNoHard}, + {"nosubcell", &extDebNoSubcell}, + {"perimeter", &extDebPerim}, + {"resist", &extDebResist}, + {"visonly", &extDebVisOnly}, + {"yank", &extDebYank}, + {0} }; /* Register ourselves with the debugging module */ @@ -496,7 +496,7 @@ ExtUnique(rootUse, option) /* Now process all the cells we just found */ nwarn = 0; - while (def = (CellDef *) StackPop(extDefStack)) + while ((def = (CellDef *) StackPop(extDefStack))) { /* EXT_UNIQ_NOTOPPORTS: Use EXT_UNIQ_ALL on all cells other than the top */ if ((option == EXT_UNIQ_NOTOPPORTS) && @@ -967,7 +967,7 @@ extExtractStack(stack, doExtract, rootDef) CellDef *def; struct saveList *newsl, *sl = (struct saveList *)NULL; - while (def = (CellDef *) StackPop(stack)) + while ((def = (CellDef *) StackPop(stack))) { def->cd_client = (ClientData) 0; if (!SigInterruptPending) diff --git a/extract/ExtNghbors.c b/extract/ExtNghbors.c index bdfa8ce0..9ea7b21a 100644 --- a/extract/ExtNghbors.c +++ b/extract/ExtNghbors.c @@ -295,7 +295,7 @@ donesides: * 1-lambda halo to find everything it overlaps or touches * on the other plane. */ - if (pMask = DBAllConnPlanes[type]) + if ((pMask = DBAllConnPlanes[type])) { TITORECT(tile, &pla.area); GEO_EXPAND(&pla.area, 1, &biggerArea); diff --git a/extract/ExtSubtree.c b/extract/ExtSubtree.c index cd7944ee..d1a854bf 100644 --- a/extract/ExtSubtree.c +++ b/extract/ExtSubtree.c @@ -680,7 +680,7 @@ extSubtreeOutputCoupling(ha) char *name; HashStartSearch(&hs); - while (he = HashNext(&ha->ha_cumFlat.et_coupleHash, &hs)) + while ((he = HashNext(&ha->ha_cumFlat.et_coupleHash, &hs))) { cap = extGetCapValue(he) / ExtCurStyle->exts_capScale; if (cap == 0) diff --git a/extract/ExtTech.c b/extract/ExtTech.c index 36435d34..bf5c4756 100644 --- a/extract/ExtTech.c +++ b/extract/ExtTech.c @@ -25,6 +25,7 @@ static char sccsid[] = "@(#)ExtTech.c 4.8 MAGIC (Berkeley) 10/26/85"; #include #include /* for strtod() */ #include +#include #include #include /* for isspace() */ @@ -96,99 +97,99 @@ typedef struct } keydesc; static keydesc keyTable[] = { - "areacap", AREAC, 3, 3, -"types capacitance", + {"areacap", AREAC, 3, 3, +"types capacitance"}, - "contact", CONTACT, 3, 6, -"type resistance", + {"contact", CONTACT, 3, 6, +"type resistance"}, - "cscale", CSCALE, 2, 2, -"capacitance-scalefactor", + {"cscale", CSCALE, 2, 2, +"capacitance-scalefactor"}, - "defaultareacap", DEFAULTAREACAP, 4, 6, -"types plane capacitance", + {"defaultareacap", DEFAULTAREACAP, 4, 6, +"types plane capacitance"}, - "defaultoverlap", DEFAULTOVERLAP, 6, 6, -"types plane otertypes otherplane capacitance", + {"defaultoverlap", DEFAULTOVERLAP, 6, 6, +"types plane otertypes otherplane capacitance"}, - "defaultperimeter", DEFAULTPERIMETER, 4, 6, -"types plane capacitance", + {"defaultperimeter", DEFAULTPERIMETER, 4, 6, +"types plane capacitance"}, - "defaultsideoverlap", DEFAULTSIDEOVERLAP, 6, 6, -"types plane othertypes otherplane capacitance", + {"defaultsideoverlap", DEFAULTSIDEOVERLAP, 6, 6, +"types plane othertypes otherplane capacitance"}, - "defaultsidewall", DEFAULTSIDEWALL, 4, 5, -"types plane capacitance [offset]", + {"defaultsidewall", DEFAULTSIDEWALL, 4, 5, +"types plane capacitance [offset]"}, - "device", DEVICE, 4, 10, -"device dev-type types options...", + {"device", DEVICE, 4, 10, +"device dev-type types options..."}, - "fet", FET, 8, 9, -"types terminal-types min-#-terminals name [subs-types] subs-node gscap gate-chan-cap", + {"fet", FET, 8, 9, +"types terminal-types min-#-terminals name [subs-types] subs-node gscap gate-chan-cap"}, - "fetresist", FETRESIST, 4, 4, -"type region ohms-per-square", + {"fetresist", FETRESIST, 4, 4, +"type region ohms-per-square"}, - "fringeshieldhalo", FRINGESHIELDHALO, 2, 2, -"distance", + {"fringeshieldhalo", FRINGESHIELDHALO, 2, 2, +"distance"}, - "height", HEIGHT, 4, 4, -"type height-above-subtrate thickness", + {"height", HEIGHT, 4, 4, +"type height-above-subtrate thickness"}, - "antenna", ANTENNA, 4, 6, -"type [calc-type] [antenna-ratio-proportional] antenna-ratio-const", + {"antenna", ANTENNA, 4, 6, +"type [calc-type] [antenna-ratio-proportional] antenna-ratio-const"}, - "model", MODEL, 2, 3, -"partial-cumulative [area-sidewall]", + {"model", MODEL, 2, 3, +"partial-cumulative [area-sidewall]"}, - "tiedown", TIEDOWN, 2, 2, -"types", + {"tiedown", TIEDOWN, 2, 2, +"types"}, - "lambda", LAMBDA, 2, 2, -"units-per-lambda", + {"lambda", LAMBDA, 2, 2, +"units-per-lambda"}, - "overlap", OVERC, 4, 5, -"toptypes bottomtypes capacitance [shieldtypes]", + {"overlap", OVERC, 4, 5, +"toptypes bottomtypes capacitance [shieldtypes]"}, - "perimc", PERIMC, 4, 4, -"intypes outtypes capacitance", + {"perimc", PERIMC, 4, 4, +"intypes outtypes capacitance"}, - "planeorder", PLANEORDER, 3, 3, -"plane index", - "noplaneordering", NOPLANEORDER, 1, 1, -"(no arguments needed)", + {"planeorder", PLANEORDER, 3, 3, +"plane index"}, + {"noplaneordering", NOPLANEORDER, 1, 1, +"(no arguments needed)"}, - "resist", RESIST, 3, 4, -"types resistance", + {"resist", RESIST, 3, 4, +"types resistance"}, - "rscale", RSCALE, 2, 2, -"resistance-scalefactor", + {"rscale", RSCALE, 2, 2, +"resistance-scalefactor"}, - "sidehalo", SIDEHALO, 2, 2, -"distance", + {"sidehalo", SIDEHALO, 2, 2, +"distance"}, - "sideoverlap", SIDEOVERLAP, 5, 6, -"intypes outtypes ovtypes capacitance [shieldtypes]", + {"sideoverlap", SIDEOVERLAP, 5, 6, +"intypes outtypes ovtypes capacitance [shieldtypes]"}, - "sidewall", SIDEWALL, 6, 7, -"intypes outtypes neartypes fartypes capacitance [offset]", + {"sidewall", SIDEWALL, 6, 7, +"intypes outtypes neartypes fartypes capacitance [offset]"}, - "step", STEP, 2, 2, -"size", + {"step", STEP, 2, 2, +"size"}, - "style", STYLE, 2, 4, -"stylename", + {"style", STYLE, 2, 4, +"stylename"}, - "substrate", SUBSTRATE, 3, 5, -"types plane [subs-node]", + {"substrate", SUBSTRATE, 3, 5, +"types plane [subs-node]"}, - "units", UNITS, 2, 2, -"lambda|microns", + {"units", UNITS, 2, 2, +"lambda|microns"}, - "variants", VARIANT, 2, 2, -"style,...", + {"variants", VARIANT, 2, 2, +"style,..."}, - 0 + {0} }; @@ -202,43 +203,43 @@ static keydesc keyTable[] = { /* types are enumerated in extract.h */ static keydesc devTable[] = { - "mosfet", DEV_MOSFET, 5, 10, -"name gate-types src-types [drn-types] sub-types|None sub-node [gscap gccap]", + {"mosfet", DEV_MOSFET, 5, 10, +"name gate-types src-types [drn-types] sub-types|None sub-node [gscap gccap]"}, - "bjt", DEV_BJT, 5, 5, -"name base-types emitter-types collector-types", + {"bjt", DEV_BJT, 5, 5, +"name base-types emitter-types collector-types"}, - "capacitor", DEV_CAP, 4, 8, -"name top-types bottom-types [sub-types|None sub-node] [[perimcap] areacap]", + {"capacitor", DEV_CAP, 4, 8, +"name top-types bottom-types [sub-types|None sub-node] [[perimcap] areacap]"}, - "capreverse", DEV_CAPREV, 4, 8, -"name bottom-types top-types [sub-types|None sub-node] [[perimcap] areacap]", + {"capreverse", DEV_CAPREV, 4, 8, +"name bottom-types top-types [sub-types|None sub-node] [[perimcap] areacap]"}, - "resistor", DEV_RES, 4, 6, -"name|None res-types terminal-types [sub-types|None sub-node]", + {"resistor", DEV_RES, 4, 6, +"name|None res-types terminal-types [sub-types|None sub-node]"}, - "diode", DEV_DIODE, 4, 6, -"name pos-types neg-types [sub-types|None sub-node]", + {"diode", DEV_DIODE, 4, 6, +"name pos-types neg-types [sub-types|None sub-node]"}, - "pdiode", DEV_PDIODE, 4, 6, -"name pos-types neg-types [sub-types|None sub-node]", + {"pdiode", DEV_PDIODE, 4, 6, +"name pos-types neg-types [sub-types|None sub-node]"}, - "ndiode", DEV_NDIODE, 4, 6, -"name neg-types pos-types [sub-types|None sub-node]", + {"ndiode", DEV_NDIODE, 4, 6, +"name neg-types pos-types [sub-types|None sub-node]"}, - "subcircuit", DEV_SUBCKT, 3, 11, -"name dev-types [N] [term1-types ... termN-types [sub-types|None sub-node]] [options]", + {"subcircuit", DEV_SUBCKT, 3, 11, +"name dev-types [N] [term1-types ... termN-types [sub-types|None sub-node]] [options]"}, - "rsubcircuit", DEV_RSUBCKT, 4, 7, -"name dev-types terminal-types [sub-types|None sub-node] [options]", + {"rsubcircuit", DEV_RSUBCKT, 4, 7, +"name dev-types terminal-types [sub-types|None sub-node] [options]"}, - "msubcircuit", DEV_MSUBCKT, 3, 11, -"name dev-types [N] [term1-types ... termN-types [sub-types|None sub-node]] [options]", + {"msubcircuit", DEV_MSUBCKT, 3, 11, +"name dev-types [N] [term1-types ... termN-types [sub-types|None sub-node]] [options]"}, - "csubcircuit", DEV_CSUBCKT, 4, 7, -"name dev-types terminal-types [sub-types|None sub-node] [options]", + {"csubcircuit", DEV_CSUBCKT, 4, 7, +"name dev-types terminal-types [sub-types|None sub-node] [options]"}, - 0 + {0} }; #ifdef MAGIC_WRAPPER @@ -2501,7 +2502,7 @@ ExtTechLine(sectionName, argc, argv) equal = TRUE; limitstr++; } - if (sscanf(limitstr, "%lg", &dval) == 0) + if (sscanf(limitstr, "%lg", &dval) != 1) { TxError("Non-numeric limit \"%s\" for parameter \"%c%s\".\n", limitstr, cond, argv[argc - 1]); @@ -2976,7 +2977,7 @@ ExtTechLine(sectionName, argc, argv) ExtCurStyle->exts_antennaModel |= ANTENNAMODEL_CUMULATIVE; else TxError("Unknown antenna model \"%s\": Use \"partial\" or " - "\"cumulative\""); + "\"cumulative\"", argv[1]); if (argc > 2) { @@ -2986,7 +2987,7 @@ ExtTechLine(sectionName, argc, argv) ExtCurStyle->exts_antennaModel |= ANTENNAMODEL_SIDEWALL; else TxError("Unknown antenna model \"%s\": Use \"surface\" or " - "\"sidewall\""); + "\"sidewall\"", argv[2]); } break; diff --git a/extract/ExtTest.c b/extract/ExtTest.c index 8b23b407..38b9c3fe 100644 --- a/extract/ExtTest.c +++ b/extract/ExtTest.c @@ -128,22 +128,22 @@ ExtractTest(w, cmd) char *cmd_name; cmdType cmd_val; } cmds[] = { - "clrdebug", CLRDEBUG, - "clrlength", CLRLENGTH, - "driver", DRIVER, - "dump", DUMP, - "interactions", INTERACTIONS, - "intercount", INTERCOUNT, - "parents", EXTPARENTS, - "receiver", RECEIVER, - "setdebug", SETDEBUG, - "showdebug", SHOWDEBUG, - "showparents", SHOWPARENTS, - "showtech", SHOWTECH, - "stats", STATS, - "step", STEP, - "times", TIME, - 0 + {"clrdebug", CLRDEBUG}, + {"clrlength", CLRLENGTH}, + {"driver", DRIVER}, + {"dump", DUMP}, + {"interactions", INTERACTIONS}, + {"intercount", INTERCOUNT}, + {"parents", EXTPARENTS}, + {"receiver", RECEIVER}, + {"setdebug", SETDEBUG}, + {"showdebug", SHOWDEBUG}, + {"showparents", SHOWPARENTS}, + {"showtech", SHOWTECH}, + {"stats", STATS}, + {"step", STEP}, + {"times", TIME}, + {0} }; if (cmd->tx_argc == 1) @@ -191,11 +191,13 @@ ExtractTest(w, cmd) "Total interaction area processed = %ld (%.2f%%) / %ld (%.2f%%)\n", extSubtreeInteractionArea, ((double) extSubtreeInteractionArea) / ((double) a1) * 100.0, + areaInteraction, ((double) areaInteraction) / ((double) a2) * 100.0); TxPrintf( "Clipped interaction area= %ld (%.2f%%) / %ld (%.2f%%)\n", extSubtreeClippedArea, ((double) extSubtreeClippedArea) / ((double) a1) * 100.0, + areaClipped, ((double) areaClipped) / ((double) a2) * 100.0); extSubtreeTotalArea = 0; extSubtreeInteractionArea = 0; @@ -452,7 +454,7 @@ extShowTech(name) out); fprintf(out, "\n"); } - if (e = ExtCurStyle->exts_sideCoupleCap[s][t]) + if ((e = ExtCurStyle->exts_sideCoupleCap[s][t])) for ( ; e; e = e->ec_next) { fprintf(out, " COUPLE: "); @@ -461,7 +463,7 @@ extShowTech(name) extShowMask(&e->ec_far, out); fprintf(out, ": %lf\n", e->ec_cap); } - if (e = ExtCurStyle->exts_sideOverlapCap[s][t]) + if ((e = ExtCurStyle->exts_sideOverlapCap[s][t])) for ( ; e; e = e->ec_next) { fprintf(out, " OVERLAP: "); diff --git a/extract/ExtTimes.c b/extract/ExtTimes.c index 1f1d21e7..7d3a6431 100644 --- a/extract/ExtTimes.c +++ b/extract/ExtTimes.c @@ -213,7 +213,7 @@ ExtTimes(rootUse, f) */ TxPrintf("Computing individual cell statistics:\n"); TxFlush(); HashStartSearch(&hs); - while (he = HashNext(&cellStatsTable, &hs)) + while ((he = HashNext(&cellStatsTable, &hs))) extTimesCellFunc((struct cellStats *) HashGetValue(he)); /* @@ -223,7 +223,7 @@ ExtTimes(rootUse, f) */ TxPrintf("Computing hierarchical and incremental statistics:\n"); TxFlush(); HashStartSearch(&hs); - while (he = HashNext(&cellStatsTable, &hs)) + while ((he = HashNext(&cellStatsTable, &hs))) extTimesIncrFunc((struct cellStats *) HashGetValue(he)); /* @@ -232,7 +232,7 @@ ExtTimes(rootUse, f) */ TxPrintf("Computing summary statistics:\n"); TxFlush(); HashStartSearch(&hs); - while (he = HashNext(&cellStatsTable, &hs)) + while ((he = HashNext(&cellStatsTable, &hs))) { extTimesSummaryFunc((struct cellStats *) HashGetValue(he), f); freeMagic((char *) HashGetValue(he)); diff --git a/extract/ExtUnique.c b/extract/ExtUnique.c index 05645a3e..98ca9b69 100644 --- a/extract/ExtUnique.c +++ b/extract/ExtUnique.c @@ -164,7 +164,8 @@ extUniqueCell(def, option) if (!(ll->ll_label->lab_flags & PORT_DIR_MASK)) for (lltest = lastreg->lreg_labels; lltest; lltest = lltest->ll_next) - if (!strcmp(lltest->ll_label->lab_text, text)) + if ((lltest->ll_label != NULL) && + (!strcmp(lltest->ll_label->lab_text, text))) if (lltest->ll_label->lab_flags & PORT_DIR_MASK) break; @@ -202,7 +203,7 @@ extMakeUnique(def, ll, lreg, lregList, labelHash, option) { static char *badmesg = "Non-global label \"%s\" attached to more than one unconnected node: %s"; - char *cpend, *text, name[1024], name2[1024], message[1024]; + char *cpend, *text, name[1024], name2[1024+32], message[1024]; LabRegion *lp2; LabelList *ll2; int nsuffix, nwarn; @@ -220,16 +221,20 @@ extMakeUnique(def, ll, lreg, lregList, labelHash, option) text = ll->ll_label->lab_text; if (option == EXT_UNIQ_ALL) goto makeUnique; - else if ((option == EXT_UNIQ_NOPORTS || option == EXT_UNIQ_NOTOPPORTS) && - (ll->ll_label->lab_flags & PORT_DIR_MASK)) + else if ((option == EXT_UNIQ_NOPORTS || option == EXT_UNIQ_NOTOPPORTS) + && !(ll->ll_label->lab_flags & PORT_DIR_MASK)) goto makeUnique; cpend = strchr(text, '\0'); if (cpend > text) cpend--; if (*cpend == '#') goto makeUnique; if (*cpend == '!') return 0; + + /* Don't generate warnings about ports when given the "noports" or + * "notopports" options. + */ if (((option == EXT_UNIQ_NOPORTS) || (option == EXT_UNIQ_NOTOPPORTS)) - && !(ll->ll_label->lab_flags & PORT_DIR_MASK)) + && (ll->ll_label->lab_flags & PORT_DIR_MASK)) return 0; /* Generate a warning for each occurrence of this label */ diff --git a/extract/ExtYank.c b/extract/ExtYank.c index ace872ee..b89c4256 100644 --- a/extract/ExtYank.c +++ b/extract/ExtYank.c @@ -233,9 +233,9 @@ extHierLabelFunc(scx, label, tpath, targetDef) newlab->lab_flags = label->lab_flags; newlab->lab_port = label->lab_port; dstp = newlab->lab_text; - for (srcp = tpath->tp_first; *dstp++ = *srcp++; ) + for (srcp = tpath->tp_first; (*dstp++ = *srcp++); ) /* Nothing */; - for (--dstp, srcp = label->lab_text; *dstp++ = *srcp++; ) + for (--dstp, srcp = label->lab_text; (*dstp++ = *srcp++); ) /* Nothing */; newlab->lab_next = targetDef->cd_labels; diff --git a/garouter/gaChannel.c b/garouter/gaChannel.c index 718631d9..56e4432e 100644 --- a/garouter/gaChannel.c +++ b/garouter/gaChannel.c @@ -381,11 +381,17 @@ gaChannelStats(list) tot = &gaTotRiverCross; clear = &gaClearRiverCross; break; + default: /* otherwise tot and clear is not intialized */ + tot = NULL; + clear = NULL; + break; + } + if (tot && clear) { + gaPinStats(ch->gcr_tPins, ch->gcr_length, tot, clear); + gaPinStats(ch->gcr_bPins, ch->gcr_length, tot, clear); + gaPinStats(ch->gcr_lPins, ch->gcr_width, tot, clear); + gaPinStats(ch->gcr_rPins, ch->gcr_width, tot, clear); } - gaPinStats(ch->gcr_tPins, ch->gcr_length, tot, clear); - gaPinStats(ch->gcr_bPins, ch->gcr_length, tot, clear); - gaPinStats(ch->gcr_lPins, ch->gcr_width, tot, clear); - gaPinStats(ch->gcr_rPins, ch->gcr_width, tot, clear); } numTot = gaTotRiverCross + gaTotNormCross; diff --git a/garouter/gaMain.c b/garouter/gaMain.c index 42e2c833..07c9bc4d 100644 --- a/garouter/gaMain.c +++ b/garouter/gaMain.c @@ -262,7 +262,7 @@ GARouteCmd(routeUse, netListName) CellUse *routeUse; char *netListName; { - int errs; + int errs = -1; NLNetList netList; GCRChannel *ch; NLNet *net; diff --git a/garouter/gaStem.c b/garouter/gaStem.c index 9abbbd01..cd58da3d 100644 --- a/garouter/gaStem.c +++ b/garouter/gaStem.c @@ -84,7 +84,7 @@ int gaNumSimplePaint, gaNumMazePaint, gaNumExtPaint; /* Forward declarations */ int gaStemContainingChannelFunc(); bool gaStemAssign(); -void gaStemGridRange(); +int gaStemGridRange(); void gaStemPaint(); bool gaStemNetClear(); bool gaStemInternalFunc(); @@ -222,7 +222,7 @@ gaStemAssign(routeUse, doWarn, loc, term, net, netList) * See if this location lies inside a river-routing channel. * If it does, return the channel containing it. */ - if (ch = gaStemContainingChannel(routeUse, doWarn, loc)) + if ((ch = gaStemContainingChannel(routeUse, doWarn, loc))) { if (ch->gcr_type != CHAN_HRIVER && ch->gcr_type != CHAN_VRIVER) goto fail; @@ -347,7 +347,7 @@ gaStemContainingChannelFunc(tile, pCh) { GCRChannel *ch; - if (ch = (GCRChannel *) tile->ti_client) + if ((ch = (GCRChannel *) tile->ti_client)) { if (*pCh) { @@ -869,7 +869,7 @@ gaStemNetClear(termArea, point, side, netList) * of 'r'. * * Results: - * None. + * 0 on success, -1 on error (no side effects). * * Side effects: * Sets *pMinGrid, *pMaxGrid, and *pStart. @@ -877,7 +877,7 @@ gaStemNetClear(termArea, point, side, netList) * ---------------------------------------------------------------------------- */ -void +int gaStemGridRange(type, r, pMinGrid, pMaxGrid, pStart) int type; Rect *r; @@ -914,7 +914,7 @@ gaStemGridRange(type, r, pMinGrid, pMaxGrid, pStart) default: { ASSERT(FALSE, "Bad channel type in gaStemGridRange"); - break; + return -1; } } max = MAX(max, start); @@ -922,6 +922,7 @@ gaStemGridRange(type, r, pMinGrid, pMaxGrid, pStart) *pMaxGrid = max; *pMinGrid = min; *pStart = start; + return 0; } /* diff --git a/garouter/gaTest.c b/garouter/gaTest.c index b05cf780..adc32ccf 100644 --- a/garouter/gaTest.c +++ b/garouter/gaTest.c @@ -98,10 +98,10 @@ GATest(w, cmd) char *cmd_name; cmdType cmd_val; } cmds[] = { - "clrdebug", CLRDEBUG, - "setdebug", SETDEBUG, - "showdebug", SHOWDEBUG, - 0 + {"clrdebug", CLRDEBUG}, + {"setdebug", SETDEBUG}, + {"showdebug", SHOWDEBUG}, + {0} }; GAInit(); @@ -388,17 +388,17 @@ GAInit() char *di_name; int *di_id; } dflags[] = { - "chanonly", &gaDebChanOnly, - "chanstats", &gaDebChanStats, - "maze", &gaDebMaze, - "nosimple", &gaDebNoSimple, - "paintstems", &gaDebPaintStems, - "showchans", &gaDebShowChans, - "showmaze", &gaDebShowMaze, - "stems", &gaDebStems, - "verbose", &gaDebVerbose, - "noclean", &gaDebNoClean, - 0 + {"chanonly", &gaDebChanOnly}, + {"chanstats", &gaDebChanStats}, + {"maze", &gaDebMaze}, + {"nosimple", &gaDebNoSimple}, + {"paintstems", &gaDebPaintStems}, + {"showchans", &gaDebShowChans}, + {"showmaze", &gaDebShowMaze}, + {"stems", &gaDebStems}, + {"verbose", &gaDebVerbose}, + {"noclean", &gaDebNoClean}, + {0} }; if (gaInitialized) diff --git a/gcr/gcrDebug.c b/gcr/gcrDebug.c index a0fad0e1..146b2ff9 100644 --- a/gcr/gcrDebug.c +++ b/gcr/gcrDebug.c @@ -20,6 +20,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include #include @@ -106,7 +107,7 @@ GCRRouteFromFile(fname) (void) GCRroute(ch); times(&tbuf2); TxPrintf("Time : %5.2fu %5.2fs\n", (tbuf2.tms_utime - - tbuf1.tms_utime)/60.0, (tbuf2.tms_stime-tbuf1.tms_stime)*60); + tbuf1.tms_utime)/60.0, (double)(tbuf2.tms_stime-tbuf1.tms_stime)*60); gcrDumpResult(ch, GcrShowEnd); gcrShowMap(ch); @@ -194,7 +195,7 @@ gcrMakeChannel(ch, fp) * p and P mean poly is blocked. Upper case means vacate the * column, lower case means vacate the track. */ - if (fscanf(fp, "%s", s) != 1) + if (fscanf(fp, "%24s", s) != 1) { TxError("Format error in router input file\n"); return (FALSE); @@ -372,14 +373,13 @@ gcrPrDensity(ch, chanDensity) { int i, diff; char name[256]; - FILE *fp; + FILE *fp, *fp_always_close; (void) sprintf(name, "dens.%d.%d.%d.%d", ch->gcr_area.r_xbot, ch->gcr_area.r_ybot, ch->gcr_area.r_xtop, ch->gcr_area.r_ytop); - fp = fopen(name, "w"); - if (fp == NULL) - fp = stdout; + fp_always_close = fopen(name, "w"); + fp = fp_always_close ? fp_always_close : stdout; fprintf(fp, "Chan width: %d\n", ch->gcr_width); fprintf(fp, "Chan length: %d\n", ch->gcr_length); @@ -423,8 +423,8 @@ gcrPrDensity(ch, chanDensity) } (void) fflush(fp); - if (fp != stdout) - (void) fclose(fp); + if (fp_always_close != NULL) + (void) fclose(fp_always_close); } /* @@ -454,33 +454,33 @@ gcrDumpPins(ch) TxPrintf("LEFT PINS\n"); for(i=0; i<=ch->gcr_width; i++) { - TxPrintf("Location [%d]=%d: x=%d, y=%d, pNext=%d, pPrev=%d, id=%d\n", - i, &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, - pinArray[i].gcr_pNext, pinArray[i].gcr_pPrev, pinArray[i].gcr_pId); + TxPrintf("Location [%d]=%ld: x=%d, y=%d, pNext=%ld, pPrev=%ld, id=%ld\n", + i, (intmax_t) &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, + (intmax_t) pinArray[i].gcr_pNext, (intmax_t) pinArray[i].gcr_pPrev, (intmax_t) pinArray[i].gcr_pId); } pinArray=ch->gcr_rPins; TxPrintf("RIGHT PINS\n"); for(i=0; i<=ch->gcr_width; i++) { - TxPrintf("Location [%d]=%d: x=%d, y=%d, pNext=%d, pPrev=%d, id=%d\n", - i, &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, - pinArray[i].gcr_pNext, pinArray[i].gcr_pPrev, pinArray[i].gcr_pId); + TxPrintf("Location [%d]=%ld: x=%d, y=%d, pNext=%ld, pPrev=%ld, id=%ld\n", + i, (intmax_t) &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, + (intmax_t) pinArray[i].gcr_pNext, (intmax_t) pinArray[i].gcr_pPrev, (intmax_t) pinArray[i].gcr_pId); } pinArray=ch->gcr_bPins; TxPrintf("BOTTOM PINS\n"); for(i=0; i<=ch->gcr_length; i++) { - TxPrintf("Location [%d]=%d: x=%d, y=%d, pNext=%d, pPrev=%d, id=%d\n", - i, &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, - pinArray[i].gcr_pNext, pinArray[i].gcr_pPrev, pinArray[i].gcr_pId); + TxPrintf("Location [%d]=%ld: x=%d, y=%d, pNext=%ld, pPrev=%ld, id=%ld\n", + i, (intmax_t) &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, + (intmax_t) pinArray[i].gcr_pNext, (intmax_t) pinArray[i].gcr_pPrev, (intmax_t) pinArray[i].gcr_pId); } pinArray=ch->gcr_tPins; TxPrintf("TOP PINS\n"); for(i=0; i<=ch->gcr_length; i++) { - TxPrintf("Location [%d]=%d: x=%d, y=%d, pNext=%d, pPrev=%d, id=%d\n", - i, &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, - pinArray[i].gcr_pNext, pinArray[i].gcr_pPrev, pinArray[i].gcr_pId); + TxPrintf("Location [%d]=%ld: x=%d, y=%d, pNext=%ld, pPrev=%ld, id=%ld\n", + i, (intmax_t) &pinArray[i], pinArray[i].gcr_x, pinArray[i].gcr_y, + (intmax_t) pinArray[i].gcr_pNext, (intmax_t) pinArray[i].gcr_pPrev, (intmax_t) pinArray[i].gcr_pId); } } @@ -507,9 +507,9 @@ gcrDumpPinList(pin, dir) { if (pin) { - TxPrintf("Location (%d, %d)=%x: pNext=%d, pPrev=%d, id=%d\n", - pin->gcr_x, pin->gcr_y, pin, - pin->gcr_pNext, pin->gcr_pPrev, pin->gcr_pId); + TxPrintf("Location (%d, %d)=%lx: pNext=%ld, pPrev=%ld, id=%ld\n", + pin->gcr_x, pin->gcr_y, (intmax_t) pin, + (intmax_t) pin->gcr_pNext, (intmax_t) pin->gcr_pPrev, (intmax_t) pin->gcr_pId); if (dir) gcrDumpPinList(pin->gcr_pNext, dir); else gcrDumpPinList(pin->gcr_pPrev, dir); } @@ -635,7 +635,7 @@ void gcrPrintCol(ch, i, showResult) } else TxPrintf("#"); } - else if ((res[i][j] & GCRU) || j != 0 && (res[i][j-1] & GCRU)) + else if ((res[i][j] & GCRU) || (j != 0 && (res[i][j-1] & GCRU))) { if((res[i][j]&GCRCC) && (!(res[i][j]&(GCRBLKM|GCRBLKP)))) { @@ -978,8 +978,12 @@ gcrShowMap(ch) while (1) { TxPrintf("Field selector (0 terminates): "); - if(!scanf("%d", &field)) /*typed something funny*/ + if(scanf("%d", &field) != 1) /*typed something funny or EOF*/ { + if (feof(stdin)) { + TxPrintf("End of input detected. Terminating.\n"); + return; + } TxPrintf("Bad input. Legal responses are\n"); TxPrintf(" GCRBLKM 1\n"); TxPrintf(" GCRBLKP 2\n"); diff --git a/gcr/gcrInit.c b/gcr/gcrInit.c index 32618449..9f47e868 100644 --- a/gcr/gcrInit.c +++ b/gcr/gcrInit.c @@ -236,7 +236,7 @@ gcrUnlinkPin(pin) { GCRNet *net; - if (net = pin->gcr_pId) + if ((net = pin->gcr_pId)) { ASSERT(pin == net->gcr_lPin, "gcrUnlinkPin"); net->gcr_lPin = pin->gcr_pNext; diff --git a/gcr/gcrShwFlgs.c b/gcr/gcrShwFlgs.c index 084a2a76..1c8b1e18 100644 --- a/gcr/gcrShwFlgs.c +++ b/gcr/gcrShwFlgs.c @@ -203,14 +203,14 @@ void gcrDumpChannel(ch) GCRChannel * ch; { - char name[20]; + char name[32]; int track, col, netCount = 0, gcrNetName(); short res; GCRNet * net, * netNames[500]; FILE * fp, * fopen(); netNames[0]=(GCRNet *) 0; - (void) sprintf(name, "channel.%p", ch); + (void) snprintf(name, sizeof(name), "channel.%p", ch); if((fp = fopen(name, "w")) == NULL) { TxError("Can't open file %s to dump channel.\n", name); diff --git a/graphics/cairo_orig/grTCairo3.c b/graphics/cairo_orig/grTCairo3.c index d86d3f0f..387fce35 100644 --- a/graphics/cairo_orig/grTCairo3.c +++ b/graphics/cairo_orig/grTCairo3.c @@ -478,7 +478,7 @@ int pixsize; { Point *tp; int np, nptotal; - int i, j; + int i, j = 0; static int maxnp = 0; FontChar *ccur; diff --git a/graphics/cairo_orig/grTCairo5.c b/graphics/cairo_orig/grTCairo5.c index 88ba9a64..903cf8e1 100644 --- a/graphics/cairo_orig/grTCairo5.c +++ b/graphics/cairo_orig/grTCairo5.c @@ -73,7 +73,7 @@ Point *p; /* screen pos of lower left corner */ } } if ((!anyObscure) && (GEO_SURROUND(&grCurClip, &bBox)) ) { - int *pixelp, x, y, thisp, lastp; + int *pixelp, x, y, thisp, lastp = -1; int color, red, green, blue, mask; /* no clipping, try to go quickly */ diff --git a/graphics/grCMap.c b/graphics/grCMap.c index b60b5b86..44e94391 100644 --- a/graphics/grCMap.c +++ b/graphics/grCMap.c @@ -156,7 +156,7 @@ char *libPath; /* a library search path */ while (fgets(inputLine, 128, f) != NULL) { argc = sscanf(inputLine, "%*d %*d %*d %d", &newmax); - if (argc == 0) + if (argc <= 0) { /* Allow comment lines */ if (*inputLine == '#') continue; diff --git a/graphics/grClip.c b/graphics/grClip.c index 7631ba75..24afe3de 100644 --- a/graphics/grClip.c +++ b/graphics/grClip.c @@ -46,7 +46,7 @@ extern void GrClipTriangle(); * lintpick happy! */ -global Rect GrCrossRect = {-GR_CROSSSIZE, -GR_CROSSSIZE, GR_CROSSSIZE, GR_CROSSSIZE}; +global Rect GrCrossRect = {{-GR_CROSSSIZE, -GR_CROSSSIZE}, {GR_CROSSSIZE, GR_CROSSSIZE}}; global int GrNumClipBoxes = 0; /* for benchmarking */ global int grCurDStyle; global unsigned char GrGridMultiple = 1; @@ -434,7 +434,7 @@ GrClipLine(x1, y1, x2, y2) { Point p1, p2; Rect c; - bool ok1, ok2; + bool ok1 = FALSE, ok2 = FALSE; c = ob->r_r; c.r_xbot--; c.r_ybot--; c.r_xtop++; c.r_ytop++; diff --git a/graphics/grDStyle.c b/graphics/grDStyle.c index 57d8f7b6..d85c15e4 100644 --- a/graphics/grDStyle.c +++ b/graphics/grDStyle.c @@ -229,7 +229,7 @@ styleBuildDisplayStyle(line, version) */ /* Allow colors to be specified by index or by name */ - if (sscanf(colorName, ((version > 6) ? "%i" : "%o"), &color) == 0) + if (sscanf(colorName, ((version > 6) ? "%i" : "%o"), &color) <= 0) color = GrNameToColor(colorName); newstyle->style.mask = (mask & grBitPlaneMask); diff --git a/graphics/grMain.c b/graphics/grMain.c index 09cc87bb..9d565e3e 100644 --- a/graphics/grMain.c +++ b/graphics/grMain.c @@ -80,7 +80,7 @@ global int GrPixelCorrect = 1; /* The following rectangle is describes the display area and is available * to the user of this module. */ -global Rect GrScreenRect = {0, 0, 0, 0}; +global Rect GrScreenRect = {{0, 0}, {0, 0}}; /* * Interrupt status for the timer. In TCL, this is used for graphics diff --git a/graphics/grOGL1.c b/graphics/grOGL1.c index ab505b9f..355ba451 100644 --- a/graphics/grOGL1.c +++ b/graphics/grOGL1.c @@ -37,12 +37,12 @@ GLubyte **grOGLStipples; HashTable grOGLWindowTable; -Display *grXdpy; +extern Display *grXdpy; /* grX11thread.c */ GLXContext grXcontext; -int grXscrn; -int pipeRead, pipeWrite; -int Xhelper; -Visual *grVisual; +extern int grXscrn; /* grX11su1.c */ +extern int pipeRead, pipeWrite; /* grX11su1.c */ +extern int Xhelper; /* grX11su1.c */ +extern Visual *grVisual; /* grX11su1.c */ #ifdef HAVE_PTHREADS extern int writePipe; @@ -375,7 +375,7 @@ glTransYs(int wy) * Set the OpenGL viewport (projection matrix) for the current window *---------------------------------------------------------------------- */ -int +void oglSetProjection(llx, lly, width, height) int llx, lly, width, height; { @@ -434,7 +434,7 @@ pipehandler() int key; XKeyPressedEvent *KeyPressedEvent = (XKeyPressedEvent *) &xevent; - entry = HashLookOnly(&grOGLWindowTable, KeyPressedEvent->window); + entry = HashLookOnly(&grOGLWindowTable, (char *)KeyPressedEvent->window); mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0; event = TxNewEvent(); @@ -457,7 +457,7 @@ pipehandler() XButtonEvent *ButtonEvent = (XButtonEvent *) &xevent; - entry = HashLookOnly(&grOGLWindowTable, ButtonEvent->window); + entry = HashLookOnly(&grOGLWindowTable, (char *)ButtonEvent->window); mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0; event = TxNewEvent(); @@ -504,7 +504,7 @@ pipehandler() width = ConfigureEvent->width; height = ConfigureEvent->height; - entry = HashLookOnly(&grOGLWindowTable, ConfigureEvent->window); + entry = HashLookOnly(&grOGLWindowTable, (char *)ConfigureEvent->window); mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0; screenRect.r_xbot = ConfigureEvent->x; @@ -525,7 +525,7 @@ pipehandler() case VisibilityNotify: { XVisibilityEvent *VisEvent = (XVisibilityEvent*) &xevent; - entry = HashLookOnly(&grOGLWindowTable, VisEvent->window); + entry = HashLookOnly(&grOGLWindowTable, (char *)VisEvent->window); mw = (entry)?(MagWindow *)HashGetValue(entry):0; switch(VisEvent->state) @@ -555,8 +555,10 @@ pipehandler() XEvent discard; XExposeEvent *ExposeEvent = (XExposeEvent*) &xevent; - entry = HashLookOnly(&grOGLWindowTable, ExposeEvent->window); + entry = HashLookOnly(&grOGLWindowTable, (char *)ExposeEvent->window); mw = (entry) ? (MagWindow *)HashGetValue(entry) : 0; + if (!mw) + break; screenRect.r_xbot = ExposeEvent->x; screenRect.r_xtop = ExposeEvent->x + ExposeEvent->width; @@ -584,7 +586,7 @@ pipehandler() XAnyEvent *AnyEvent = (XAnyEvent *) &xevent; - entry = HashLookOnly(&grOGLWindowTable, AnyEvent->window); + entry = HashLookOnly(&grOGLWindowTable, (char *)AnyEvent->window); mw = (entry)?(MagWindow *)HashGetValue(entry):0; SigDisableInterrupts(); @@ -718,14 +720,16 @@ oglSetDisplay (dispType, outFileName, mouseFileName) grSetCharSizePtr = groglSetCharSize; grFillPolygonPtr = groglFillPolygon; - if (execFailed) { + if (execFailed) + { TxError("Execution failed!\n"); return FALSE; } TxAdd1InputDevice(fileno(stdin), grOGLWStdin, (ClientData) NULL); - if(!GrOGLInit()){ + if (!GrOGLInit()) + { return FALSE; } GrScreenRect.r_xbot = 0; @@ -848,7 +852,7 @@ GrOGLCreate(w, name) glXMakeCurrent(grXdpy, (GLXDrawable)wind, grXcontext); w->w_grdata = (ClientData) wind; - entry = HashFind(&grOGLWindowTable, wind); + entry = HashFind(&grOGLWindowTable, (char *)wind); HashSetValue(entry,w); XDefineCursor(grXdpy, wind, oglCurrent.cursor); GrOGLIconUpdate(w, w->w_caption); @@ -910,7 +914,7 @@ GrOGLDelete(w) HashEntry *entry; xw = (Window) w->w_grdata; - entry = HashLookOnly(&grOGLWindowTable,xw); + entry = HashLookOnly(&grOGLWindowTable, (char *)xw); HashSetValue(entry,NULL); XDestroyWindow(grXdpy, xw); diff --git a/graphics/grOGL5.c b/graphics/grOGL5.c index f4ab4d0f..79c8a4d6 100644 --- a/graphics/grOGL5.c +++ b/graphics/grOGL5.c @@ -36,7 +36,7 @@ extern HashTable grOGLWindowTable; extern Display *grXdpy; extern int grXscrn; -Cursor grCursors[MAX_CURSORS]; +extern Cursor grCursors[MAX_CURSORS]; /* grX11su5.c */ /* diff --git a/graphics/grTCairo1.c b/graphics/grTCairo1.c index 29fc05eb..bdb2bff3 100644 --- a/graphics/grTCairo1.c +++ b/graphics/grTCairo1.c @@ -1079,7 +1079,7 @@ char *name; static int WindowNumber = 0; HashEntry *entry; char *windowplace; - char windowname[10]; + char windowname[32]; int x = w->w_frameArea.r_xbot; int y = grTransYs(w->w_frameArea.r_ytop); int width = w->w_frameArea.r_xtop - w->w_frameArea.r_xbot; @@ -1090,7 +1090,7 @@ char *name; WindSeparateRedisplay(w); sprintf(windowname, ".magic%d", WindowNumber + 1); - if (windowplace = XGetDefault(grXdpy, "magic", windowname)) + if ((windowplace = XGetDefault(grXdpy, "magic", windowname))) { XParseGeometry(windowplace, &x, &y, (unsigned int *)&width, (unsigned int *)&height); @@ -1106,7 +1106,7 @@ char *name; grAttributes.background_pixel = WhitePixel(grXdpy, grXscrn); grAttributes.border_pixel = BlackPixel(grXdpy, grXscrn); - if (tktop = Tk_MainWindow(magicinterp)) + if ((tktop = Tk_MainWindow(magicinterp))) { if (!WindowNumber) { @@ -1490,7 +1490,7 @@ char *text; XSetClassHint( grXdpy, wind, &class); if (text) { - if (brack = strchr(text, '[')) + if ((brack = strchr(text, '['))) { brack--; *brack = 0; @@ -1499,7 +1499,7 @@ char *text; *brack = ' '; return; } - if (brack = strrchr(text, ' ')) text = brack + 1; + if ((brack = strrchr(text, ' '))) text = brack + 1; XSetIconName(grXdpy, wind, text); XStoreName(grXdpy, wind, text); } diff --git a/graphics/grTCairo5.c b/graphics/grTCairo5.c index 2f1de6eb..1774f657 100644 --- a/graphics/grTCairo5.c +++ b/graphics/grTCairo5.c @@ -199,7 +199,7 @@ int cursorNum; /* The cursor number as defined in the display tcairoCurrent.cursor = grCursors[cursorNum]; HashStartSearch(&hs); - while (entry = HashNext(&grTCairoWindowTable, &hs)) + while ((entry = HashNext(&grTCairoWindowTable, &hs))) { if (HashGetValue(entry)) { diff --git a/graphics/grTOGL1.c b/graphics/grTOGL1.c index 509a47ca..400878b8 100644 --- a/graphics/grTOGL1.c +++ b/graphics/grTOGL1.c @@ -599,7 +599,7 @@ keys_and_buttons: idxmax = (nbytes == 0) ? 1 : nbytes; for (idx = 0; idx < idxmax; idx++) { - if (inChar[idx] == 3) /* Ctrl-C interrupt */ + if (nbytes > 0 && inChar[idx] == 3) /* Ctrl-C interrupt */ { if (SigInterruptPending) MainExit(0); /* double Ctrl-C */ @@ -1081,7 +1081,7 @@ GrTOGLCreate(w, name) static int WindowNumber = 0; HashEntry *entry; char *windowplace; - char windowname[10]; + char windowname[32]; int x = w->w_frameArea.r_xbot; int y = glTransYs(w->w_frameArea.r_ytop); int width = w->w_frameArea.r_xtop - w->w_frameArea.r_xbot; @@ -1092,7 +1092,7 @@ GrTOGLCreate(w, name) WindSeparateRedisplay(w); sprintf(windowname, ".magic%d", WindowNumber + 1); - if (windowplace = XGetDefault(grXdpy, "magic", windowname)) + if ((windowplace = XGetDefault(grXdpy, "magic", windowname))) { XParseGeometry(windowplace,&x,&y, (unsigned int *)&width,(unsigned int *)&height); @@ -1108,7 +1108,7 @@ GrTOGLCreate(w, name) grAttributes.background_pixel = WhitePixel(grXdpy,grXscrn); grAttributes.border_pixel = BlackPixel(grXdpy,grXscrn); - if (tktop = Tk_MainWindow(magicinterp)) + if ((tktop = Tk_MainWindow(magicinterp))) { if (!WindowNumber) { @@ -1539,7 +1539,7 @@ GrTOGLIconUpdate(w,text) /* See Blt code */ XSetClassHint( grXdpy, wind, &class); if (text) { - if (brack = strchr(text,'[')) + if ((brack = strchr(text,'['))) { brack--; *brack = 0; @@ -1548,7 +1548,7 @@ GrTOGLIconUpdate(w,text) /* See Blt code */ *brack = ' '; return; } - if (brack = strrchr(text,' ')) text = brack+1; + if ((brack = strrchr(text,' '))) text = brack+1; XSetIconName(grXdpy,wind,text); XStoreName(grXdpy,wind,text); } diff --git a/graphics/grTOGL3.c b/graphics/grTOGL3.c index 192a30df..3414f3a4 100644 --- a/graphics/grTOGL3.c +++ b/graphics/grTOGL3.c @@ -228,6 +228,7 @@ GrTOGLTextSize(text, size, r) font = grXLargeFont; break; default: + font = NULL; TxError("%s%d\n", "GrTOGLTextSize: Unknown character size ", size ); break; diff --git a/graphics/grTOGL5.c b/graphics/grTOGL5.c index ffe271f8..8aadcbba 100644 --- a/graphics/grTOGL5.c +++ b/graphics/grTOGL5.c @@ -198,7 +198,7 @@ GrTOGLSetCursor(cursorNum) toglCurrent.cursor = grCursors[cursorNum]; HashStartSearch(&hs); - while (entry = HashNext(&grTOGLWindowTable,&hs)) + while ((entry = HashNext(&grTOGLWindowTable,&hs))) { if (HashGetValue(entry)) { diff --git a/graphics/grTk1.c b/graphics/grTk1.c index c1fd2060..ea31b786 100644 --- a/graphics/grTk1.c +++ b/graphics/grTk1.c @@ -535,7 +535,7 @@ GrTkInit(dispType) } else { - TxPrintf("Using %s, VisualID 0x%x depth %d\n", + TxPrintf("Using %s, VisualID 0x%lx depth %d\n", visual_type[grvisual_get[gritems].class], grvisual_get[gritems].visualid, grvisual_get[gritems].depth); @@ -1308,7 +1308,7 @@ GrTkCreate(w, name) static int WindowNumber = 0; HashEntry *entry; char *windowplace; - char windowname[10]; + char windowname[32]; int x = w->w_frameArea.r_xbot; int y = grMagicToXs(w->w_frameArea.r_ytop); int width = w->w_frameArea.r_xtop - w->w_frameArea.r_xbot; @@ -1322,7 +1322,7 @@ GrTkCreate(w, name) WindSeparateRedisplay(w); sprintf(windowname, ".magic%d", WindowNumber + 1); - if (windowplace = XGetDefault(grXdpy, "magic", windowname)) + if ((windowplace = XGetDefault(grXdpy, "magic", windowname))) { XParseGeometry(windowplace,&x,&y, (unsigned int *)&width,(unsigned int *)&height); @@ -1339,7 +1339,7 @@ GrTkCreate(w, name) if(grClass == 3) grDepth = 8; /* Needed since grDisplay.depth is reset to 7 if Pseudocolor */ - if (tktop = Tk_MainWindow(magicinterp)) + if ((tktop = Tk_MainWindow(magicinterp))) { if (!WindowNumber) { @@ -1754,7 +1754,7 @@ GrTkIconUpdate(w, text) /* See Blt code */ class.res_class = "magic"; XSetClassHint( grXdpy, wind, &class); - if (brack = strchr(text,'[')) + if ((brack = strchr(text,'['))) { brack--; *brack = 0; @@ -1763,7 +1763,7 @@ GrTkIconUpdate(w, text) /* See Blt code */ *brack = ' '; return; } - if (brack = strrchr(text,' ')) text = brack+1; + if ((brack = strrchr(text,' '))) text = brack+1; XSetIconName(grXdpy,wind,text); XStoreName(grXdpy,wind,text); } diff --git a/graphics/grTk3.c b/graphics/grTk3.c index e942bc5d..889ef98d 100644 --- a/graphics/grTk3.c +++ b/graphics/grTk3.c @@ -201,6 +201,7 @@ GrTkTextSize(text, size, r) font = grXLargeFont; break; default: + font = NULL; TxError("%s%d\n", "GrTkTextSize: Unknown character size ", size ); break; @@ -244,7 +245,7 @@ GrTkReadPixel (w, x, y) image = XGetImage(grXdpy, grCurrent.windowid, x, grMagicToX(y), 1, 1, ~0, ZPixmap); value = XGetPixel(image, 0, 0); - return (value & (1 << grDisplay.depth) - 1); + return (value & ((1 << grDisplay.depth) - 1)); } diff --git a/graphics/grTk5.c b/graphics/grTk5.c index fa4b155e..beda86f5 100644 --- a/graphics/grTk5.c +++ b/graphics/grTk5.c @@ -174,7 +174,7 @@ GrTkSetCursor(cursorNum) grCurrent.cursor = grCursors[cursorNum]; HashStartSearch(&hs); - while (entry = HashNext(&grTkWindowTable,&hs)) + while ((entry = HashNext(&grTkWindowTable,&hs))) { if (HashGetValue(entry)) { diff --git a/graphics/grX11su1.c b/graphics/grX11su1.c index e4485698..f2efa4c9 100644 --- a/graphics/grX11su1.c +++ b/graphics/grX11su1.c @@ -52,7 +52,7 @@ extern char *DBWStyleType; -Display *grXdpy; +extern Display *grXdpy; /* grX11thread.c */ int grXscrn; Colormap grXcmap; Visual *grVisual; @@ -143,7 +143,7 @@ grx11SetWMandC (mask, c) static int oldM = -1; c = grPixels[c]; - if(grDisplay.depth <= 8) { + if (grDisplay.depth <= 8) { mask = grPlanes[mask]; if (mask == -65) mask = AllPlanes; } @@ -413,7 +413,7 @@ GrX11Init(dispType) grtemplate.screen = grXscrn; grtemplate.depth = 0; grvisual_get = XGetVisualInfo(grXdpy, VisualScreenMask, &grtemplate, &gritems); - if(grvisual_get == NULL) + if (grvisual_get == NULL) { TxPrintf("Could not obtain Visual Info from Server %s. " "Will attempt default.\n", getenv("DISPLAY")); @@ -794,7 +794,7 @@ grX11Stdin() } grCurrent.window = ButtonEvent->window; - entry = HashLookOnly(&grX11WindowTable,grCurrent.window); + entry = HashLookOnly(&grX11WindowTable, (char *)grCurrent.window); grCurrent.mw= (entry)?(MagWindow *)HashGetValue(entry):0; event->txe_p.p_x = ButtonEvent->x; @@ -811,7 +811,7 @@ grX11Stdin() event = TxNewEvent(); grCurrent.window = KeyPressedEvent->window; - entry = HashLookOnly(&grX11WindowTable,grCurrent.window); + entry = HashLookOnly(&grX11WindowTable, (char *)grCurrent.window); grCurrent.mw= (entry)?(MagWindow *)HashGetValue(entry):0; read(pipeRead, &c, sizeof(int)); @@ -832,9 +832,11 @@ grX11Stdin() MagWindow *w; grCurrent.window = ExposeEvent->window; - entry = HashLookOnly(&grX11WindowTable,grCurrent.window); + entry = HashLookOnly(&grX11WindowTable, (char *)grCurrent.window); w = (entry)?(MagWindow *)HashGetValue(entry):0; grCurrent.mw=w; + if (!w) + break; screenRect.r_xbot = ExposeEvent->x; screenRect.r_xtop = ExposeEvent->x+ExposeEvent->width; @@ -865,7 +867,7 @@ grX11Stdin() MagWindow *w; grCurrent.window = ConfigureEvent->window; - entry = HashLookOnly(&grX11WindowTable,grCurrent.window); + entry = HashLookOnly(&grX11WindowTable, (char *)grCurrent.window); w = (entry)?(MagWindow *)HashGetValue(entry):0; grCurrent.mw=w; @@ -886,8 +888,10 @@ grX11Stdin() XVisibilityEvent *VisEvent = (XVisibilityEvent*) &xevent; MagWindow *w; - entry = HashLookOnly(&grX11WindowTable, VisEvent->window); + entry = HashLookOnly(&grX11WindowTable, (char *)VisEvent->window); w = (entry)?(MagWindow *)HashGetValue(entry):0; + if (!w) + break; switch(VisEvent->state) { @@ -916,14 +920,14 @@ grX11Stdin() MagWindow *w; grCurrent.window = anyEvent->window; - entry = HashLookOnly(&grX11WindowTable, grCurrent.window); + entry = HashLookOnly(&grX11WindowTable, (char *)grCurrent.window); w = (entry)?(MagWindow *)HashGetValue(entry):0; /* The line above is defintely NOT a good idea. w == 0 causes address exception. Why X11 is generating an event for a non-existent window is another question... ***mdg*** */ - if(w == 0) {printf("CreateNotify: w = %d.\n", w); break;} + if (w == 0) {printf("CreateNotify: w = %d.\n", w); break;} SigDisableInterrupts(); WindView(w); SigEnableInterrupts(); @@ -1179,13 +1183,13 @@ GrX11Create(w, name) grAttributes.border_pixel = BlackPixel(grXdpy,grXscrn); grAttributes.colormap = grXcmap; grDepth = grDisplay.depth; - if(grClass == 3) grDepth = 8; /* Needed since grDisplay.depth is reset + if (grClass == 3) grDepth = 8; /* Needed since grDisplay.depth is reset to 7 if Pseudocolor */ #ifdef HIRESDB TxPrintf("x %d y %d width %d height %d depth %d class %d mask %d\n", x,y,width,height, grDepth, grClass, attribmask); #endif /* HIRESDB */ - if ( wind = XCreateWindow(grXdpy, XDefaultRootWindow(grXdpy), + if (wind = XCreateWindow(grXdpy, XDefaultRootWindow(grXdpy), x, y, width, height, 0, grDepth, InputOutput, grVisual, attribmask, &grAttributes)) { @@ -1229,7 +1233,7 @@ GrX11Create(w, name) grCurrent.mw = w; w->w_grdata = (ClientData) wind; - entry = HashFind(&grX11WindowTable,grCurrent.window); + entry = HashFind(&grX11WindowTable, (char *)grCurrent.window); HashSetValue(entry,w); XDefineCursor(grXdpy, grCurrent.window,grCurrent.cursor); @@ -1278,7 +1282,7 @@ GrX11Delete(w) HashEntry *entry; xw = (Window) w->w_grdata; - entry = HashLookOnly(&grX11WindowTable,xw); + entry = HashLookOnly(&grX11WindowTable, (char *)xw); HashSetValue(entry,NULL); XDestroyWindow(grXdpy,xw); diff --git a/grouter/grouteCrss.c b/grouter/grouteCrss.c index 3d12540b..ffe49b81 100644 --- a/grouter/grouteCrss.c +++ b/grouter/grouteCrss.c @@ -166,7 +166,7 @@ glCrossTakePin(rootUse, pin, netid) GCRPin *pin; /* Pin to take */ NetId netid; /* Identifier to assign */ { - char c[256], name1[1024], name2[1024]; + char c[2048+64], name1[1024], name2[1024]; Rect r; if (DebugIsSet(glDebugID, glDebGreedy)) diff --git a/grouter/grouteMain.c b/grouter/grouteMain.c index e1dfd23d..1a673a5a 100644 --- a/grouter/grouteMain.c +++ b/grouter/grouteMain.c @@ -360,7 +360,7 @@ glProcessLoc(startList, loc, bestCost, doFast) } else glMazeShortest = FALSE; bestPt = (GlPoint *) NULL; - while (lastPt = glMazeFindPath(loc, bestCost)) + while ((lastPt = glMazeFindPath(loc, bestCost))) { adjustedPt = glCrossAdjust((GlPoint *) NULL, lastPt); if (adjustedPt->gl_cost < bestCost) diff --git a/grouter/grouteMaze.c b/grouter/grouteMaze.c index d422d6ba..50d73467 100644 --- a/grouter/grouteMaze.c +++ b/grouter/grouteMaze.c @@ -26,6 +26,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include "utils/magic.h" #include "utils/geometry.h" #include "utils/geofast.h" @@ -569,7 +570,7 @@ glMazeResetCost(headPage, headFree) for (gpage = headPage; gpage; gpage = gpage->glp_next) { for (n = headFree; n < gpage->glp_free; n++) - if (pin = gpage->glp_array[n].gl_pin) + if ((pin = gpage->glp_array[n].gl_pin)) { pin->gcr_cost = INFINITY; if (pin->gcr_linked) @@ -595,10 +596,10 @@ glPathPrint(path) pin = rp->gl_pin; ch = pin->gcr_ch; tp = rp->gl_tile; - TxPrintf("(%d,%d) cost=%d pcost=%d pId=%d/%d\n", + TxPrintf("(%d,%d) cost=%d pcost=%d pId=%ld/%d\n", pin->gcr_point.p_x, pin->gcr_point.p_y, rp->gl_cost, pin->gcr_cost, - pin->gcr_pId, pin->gcr_pSeg); + (intmax_t) pin->gcr_pId, pin->gcr_pSeg); TxPrintf("\tchan=(%d,%d,%d,%d)/%d\n", ch->gcr_area.r_xbot, ch->gcr_area.r_ybot, ch->gcr_area.r_xtop, ch->gcr_area.r_ytop, diff --git a/grouter/groutePath.c b/grouter/groutePath.c index 13e62d9e..f4dd32a9 100644 --- a/grouter/groutePath.c +++ b/grouter/groutePath.c @@ -124,7 +124,7 @@ glListToHeap(list, destPt) * to lie along that channel portion). */ pin = temp->gl_pin; - if (tp = glChanPinToTile((Tile *) NULL, pin)) + if ((tp = glChanPinToTile((Tile *) NULL, pin))) { new = glPathNew(pin, temp->gl_cost, (GlPoint *) NULL); new->gl_tile = tp; diff --git a/grouter/groutePin.c b/grouter/groutePin.c index f286ad15..5384d109 100644 --- a/grouter/groutePin.c +++ b/grouter/groutePin.c @@ -130,7 +130,7 @@ glPointToPin(ch, side, point) * ---------------------------------------------------------------------------- */ -int +void GLInitPins(ch) GCRChannel *ch; { @@ -140,7 +140,7 @@ GLInitPins(ch) glPinArrayInit(ch, GEO_EAST, ch->gcr_rPins, ch->gcr_width); } -int +void glPinArrayInit(ch, side, pins, nPins) GCRChannel *ch; GCRPin *pins; @@ -352,7 +352,7 @@ glPinArrayBlock(ch, pins, opins, nPins) * ---------------------------------------------------------------------------- */ -int +void GLLinkPins(ch) GCRChannel *ch; { @@ -362,7 +362,7 @@ GLLinkPins(ch) glPinArrayLink(ch->gcr_rPins, ch->gcr_width); } -int +void glPinArrayLink(pins, nPins) GCRPin *pins; int nPins; @@ -452,7 +452,7 @@ glShowPin(pin) * ---------------------------------------------------------------------------- */ -int +void GLFixStemPins(ch) GCRChannel *ch; { @@ -462,7 +462,7 @@ GLFixStemPins(ch) glPinArrayFixStems(ch->gcr_rPins, ch->gcr_width); } -int +void glPinArrayFixStems(pins, nPins) GCRPin *pins; int nPins; diff --git a/grouter/grouteTest.c b/grouter/grouteTest.c index 27b5163f..77a17cf2 100644 --- a/grouter/grouteTest.c +++ b/grouter/grouteTest.c @@ -21,6 +21,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include #include @@ -123,12 +124,12 @@ GlTest(w, cmd) char *cmd_name; cmdType cmd_val; } cmds[] = { - "clrdebug", CLRDEBUG, - "onlynet", ONLYNET, - "setdebug", SETDEBUG, - "showdebug", SHOWDEBUG, - "sides", SIDES, - 0 + {"clrdebug", CLRDEBUG}, + {"onlynet", ONLYNET}, + {"setdebug", SETDEBUG}, + {"showdebug", SHOWDEBUG}, + {"sides", SIDES}, + {0} }; if (!glInitialized) @@ -261,24 +262,24 @@ GlInit() char *di_name; int *di_id; } dflags[] = { - "allpoints", &glDebAllPoints, - "chan", &glDebChan, - "cross", &glDebCross, - "fast", &glDebFast, - "heap", &glDebHeap, - "histo", &glDebHisto, - "log", &glDebLog, - "greedy", &glDebGreedy, - "maze", &glDebMaze, - "net", &glDebNet, - "newheaps", &glDebNewHeaps, - "penalties", &glDebPen, - "showpins", &glDebShowPins, - "stemsonly", &glDebStemsOnly, - "straight", &glDebStraight, - "tiles", &glDebTiles, - "verbose", &glDebVerbose, - 0 + {"allpoints", &glDebAllPoints}, + {"chan", &glDebChan}, + {"cross", &glDebCross}, + {"fast", &glDebFast}, + {"heap", &glDebHeap}, + {"histo", &glDebHisto}, + {"log", &glDebLog}, + {"greedy", &glDebGreedy}, + {"maze", &glDebMaze}, + {"net", &glDebNet}, + {"newheaps", &glDebNewHeaps}, + {"penalties", &glDebPen}, + {"showpins", &glDebShowPins}, + {"stemsonly", &glDebStemsOnly}, + {"straight", &glDebStraight}, + {"tiles", &glDebTiles}, + {"verbose", &glDebVerbose}, + {0} }; if (glInitialized) @@ -371,9 +372,9 @@ glShowCross(pin, netId, kind) { (void) strcpy(name1, NLNetName(pin->gcr_pId)); (void) strcpy(name2, NLNetName(netId.netid_net)); - TxPrintf("%s (%d,%d), Net %s/%d->%s/%d, Ch %d\n", + TxPrintf("%s (%d,%d), Net %s/%d->%s/%d, Ch %ld\n", name, pin->gcr_point.p_x, pin->gcr_point.p_y, - name1, pin->gcr_pSeg, name2, netId.netid_seg, pin->gcr_ch); + name1, pin->gcr_pSeg, name2, netId.netid_seg, (intmax_t) pin->gcr_ch); } r.r_ll = r.r_ur = pin->gcr_point; diff --git a/irouter/irCommand.c b/irouter/irCommand.c index f48c2c10..b91afa70 100644 --- a/irouter/irCommand.c +++ b/irouter/irCommand.c @@ -110,8 +110,8 @@ irSetNoisyAutoInt(parm, valueS, file) char *sv_name; /* name */ int sv_type; } specialValues[] = { - "automatic", V_AUTOMATIC, - 0 + {"automatic", V_AUTOMATIC}, + {0} }; /* If value non-null set parm */ @@ -679,9 +679,9 @@ FILE *file; char *sp_name; /* name */ int sp_type; } specialArgs[] = { - "command", SP_COMMAND, - ".", SP_DOT, - 0 + {"command", SP_COMMAND}, + {".", SP_DOT}, + {0} }; if(s!=NULL) @@ -785,11 +785,11 @@ static struct void (*cP_proc)(); /* Procedure processing this parameter */ #endif } cParms[] = { - "active", irCSetActive, - "width", irCSetWidth, - "length", irCSetLength, - "cost", irCSetCost, - 0 + {"active", irCSetActive}, + {"width", irCSetWidth}, + {"length", irCSetLength}, + {"cost", irCSetCost}, + {0} }; /* NEXTVALUE - returns pointer to next value arg (string). */ @@ -898,7 +898,7 @@ irContactsCmd(w, cmd) return; } - if(rC=irFindRouteContact(tileType)) + if((rC=irFindRouteContact(tileType))) { /* Print Contact Heading */ TxPrintf("%-12.12s ", "contact"); @@ -996,7 +996,7 @@ irContactsCmd(w, cmd) return; } - if(rC=irFindRouteContact(tileType)) + if((rC=irFindRouteContact(tileType))) { /* Lookup contact parameter name in table */ which = LookupStruct( @@ -1154,15 +1154,15 @@ static struct void (*lP_proc)(); /* procedure processing this parameter */ #endif } lParms[] = { - "active", irLSetActive, - "width", irLSetWidth, - "length", irLSetLength, - "hCost", irLSetHCost, - "vCost", irLSetVCost, - "jogCost", irLSetJogCost, - "hintCost", irLSetHintCost, - "overCost", irLSetOverCost, - 0 + {"active", irLSetActive}, + {"width", irLSetWidth}, + {"length", irLSetLength}, + {"hCost", irLSetHCost}, + {"vCost", irLSetVCost}, + {"jogCost", irLSetJogCost}, + {"hintCost", irLSetHintCost}, + {"overCost", irLSetOverCost}, + {0} }; /* NEXTVALUE - returns pointer to next value arg (string). */ @@ -1272,7 +1272,7 @@ irLayersCmd(w, cmd) return; } - if (rL=irFindRouteLayer(tileType)) + if ((rL=irFindRouteLayer(tileType))) { /* Print Route Layer Heading */ TxPrintf("%-12.12s ", "layer"); @@ -1372,7 +1372,7 @@ irLayersCmd(w, cmd) return; } - if (rL=irFindRouteLayer(tileType)) + if ((rL=irFindRouteLayer(tileType))) { /* Lookup route layer parameter name in table */ which = LookupStruct( @@ -1747,9 +1747,9 @@ static struct char *srP_name; /* name of parameter */ void (*srP_proc)(); /* Procedure processing this parameter */ } srParms[] = { - "rate", irSrSetRate, - "width", irSrSetWidth, - 0 + {"rate", irSrSetRate}, + {"width", irSrSetWidth}, + {0} }; void @@ -1868,11 +1868,11 @@ irSpacingsCmd(w, cmd) char *sV_name; /* name of value */ int sV_value; /* corresponding interger value */ } sValue[] = { - "n", -1, - "nil", -1, - "none", -1, - "null", -1, - 0 + {"n", -1}, + {"nil", -1}, + {"none", -1}, + {"null", -1}, + {0} }; /* Subcell Table */ @@ -1881,8 +1881,8 @@ irSpacingsCmd(w, cmd) char *sT_name; /* name of value */ int sT_value; /* corresponding interger value */ } subcellTable[] = { - "subcell", TT_SUBCELL, - 0 + {"subcell", TT_SUBCELL}, + {0} }; /* Process by case */ @@ -1928,7 +1928,7 @@ irSpacingsCmd(w, cmd) return; } - if (rT=irFindRouteType(tileType)) + if ((rT=irFindRouteType(tileType))) { TxPrintf("%s: ", @@ -2238,15 +2238,15 @@ static struct char *wzdP_name; /* name of parameter */ void (*wzdP_proc)(); /* Procedure processing this parameter */ } wzdParms[] = { - "bloom", irWzdSetBloomCost, - "bloomLimit", irWzdSetBloomLimit, - "boundsIncrement", irWzdSetBoundsIncrement, - "estimate", irWzdSetEstimate, - "expandEndpoints", irWzdSetExpandEndpoints, - "penalty", irWzdSetPenalty, - "penetration", irWzdSetPenetration, - "window", irWzdSetWindow, - 0 + {"bloom", irWzdSetBloomCost}, + {"bloomLimit", irWzdSetBloomLimit}, + {"boundsIncrement", irWzdSetBoundsIncrement}, + {"estimate", irWzdSetEstimate}, + {"expandEndpoints", irWzdSetExpandEndpoints}, + {"penalty", irWzdSetPenalty}, + {"penetration", irWzdSetPenetration}, + {"window", irWzdSetWindow}, + {0} }; void @@ -2510,21 +2510,21 @@ irSaveParametersCmd(w, cmd) /*--- Subcommand Table ---*/ SubCmdTableE irSubcommands[] = { - "contacts", irContactsCmd, + {"contacts", irContactsCmd, "set route-contact parameters", "contacts [type] [parameter] [value1] ... [valuen]\n\ -\t(can use '*' for type or parameter)", +\t(can use '*' for type or parameter)"}, - "help", irHelpCmd, + {"help", irHelpCmd, "summarize iroute subcommands", - "help [subcommand]", + "help [subcommand]"}, - "layers", irLayersCmd, + {"layers", irLayersCmd, "set route-layer parameters", "layers [type] [parameter] [value1] ... [valuen]\n\ -\t(can use '*' for type or parameter)", +\t(can use '*' for type or parameter)"}, - "route", irRouteCmd, + {"route", irRouteCmd, "connect point to node(s)", "route [options]\n\ \t-sLayers layers = layers route may start on.\n\ @@ -2535,38 +2535,38 @@ SubCmdTableE irSubcommands[] = { \t-dBox = route to box (DEFAULT)\n\ \t-dLabel name = route to label of given name\n\ \t-dRect xbot ybot xtop ytop = route to rectangle of given coordinates\n\ -\t-dSelection = route to selection", +\t-dSelection = route to selection"}, - "saveParameters", irSaveParametersCmd, + {"saveParameters", irSaveParametersCmd, "write out all irouter parameters\n\ \t(can be read back with :source)", - "saveParameters ", + "saveParameters "}, - "search", irSearchCmd, + {"search", irSearchCmd, "set parameters controlling the internal search for routes", - "search [searchParameter] [value]", + "search [searchParameter] [value]"}, - "spacings", irSpacingsCmd, + {"spacings", irSpacingsCmd, "set minimum spacing between route-type and arbitrary type", "spacings [route-type] [type] [spacing] ... [typen spacingn]\n\ \t(types can be 'SUBCELL', spacing can be 'nil')\n\ iroute spacings CLEAR\n\ -\t(sets all spacings to nil)", +\t(sets all spacings to nil)"}, - "verbosity", irVerbosityCmd, + {"verbosity", irVerbosityCmd, "control the amount of messages printed", "verbosity [level]\n\ -\t(0 = errors and warnings only, 1 = brief, 2 = lots of statistics)", +\t(0 = errors and warnings only, 1 = brief, 2 = lots of statistics)"}, - "version", irVersionCmd, + {"version", irVersionCmd, "identify irouter version", - "version", + "version"}, - "wizard", irWizardCmd, + {"wizard", irWizardCmd, "set miscellaneous parameters", - "wizard [wizardParameter] [value]", + "wizard [wizardParameter] [value]"}, - 0 + {0} }, *subCmdP; void diff --git a/irouter/irMain.c b/irouter/irMain.c index 8ccf636d..42e82ace 100644 --- a/irouter/irMain.c +++ b/irouter/irMain.c @@ -99,9 +99,9 @@ IRDebugInit() char *di_name; int *di_id; } dflags[] = { - "endpts", &irDebEndPts, - "noclean", &irDebNoClean, - 0 + {"endpts", &irDebEndPts}, + {"noclean", &irDebNoClean}, + {0} }; /* Register with debug module */ diff --git a/irouter/irRoute.c b/irouter/irRoute.c index 8d7e9b9e..96a96e3b 100644 --- a/irouter/irRoute.c +++ b/irouter/irRoute.c @@ -595,6 +595,7 @@ irGetStartPoint(startType, argStartPt, argStartLabel, startLayerPtr, routeUse) /* shouldn't happen */ { ASSERT(FALSE,"irGetStartPoint"); + goto abort; } break; } @@ -720,6 +721,7 @@ irGetDestRect(destType, argDestRect, argDestLabel, destLayerPtr, routeUse) /* shouldn't happen */ { ASSERT(FALSE,"irGetDestRect"); + goto abort; } break; } @@ -1098,7 +1100,7 @@ irChooseEndPtLayers(routeUse,expansionMask,endPt,argLayers,endPtName) } TxPrintf("\n"); - for(pickedRC=FALSE,l=presentContacts; l && !pickedRC; l=LIST_TAIL(l)) + for(pickedRC=NULL,l=presentContacts; l && !pickedRC; l=LIST_TAIL(l)) { rC = (RouteContact *) LIST_FIRST(l); if (!LIST_TAIL(l) && !presentLayers) diff --git a/irouter/irTestCmd.c b/irouter/irTestCmd.c index 8919105c..59fa973f 100644 --- a/irouter/irTestCmd.c +++ b/irouter/irTestCmd.c @@ -220,20 +220,20 @@ irParmsTstCmd(w, cmd) /*--------------------------- Command Table ------------------------------ */ TestCmdTableE irTestCommands[] = { - "debug", irDebugTstCmd, + {"debug", irDebugTstCmd, "set or clear debug flags", - "debug [flag] [value]", + "debug [flag] [value]"}, - "help", irHelpTstCmd, + {"help", irHelpTstCmd, "summarize *iroute subcommands", - "help [subcommand]", + "help [subcommand]"}, - "parms", irParmsTstCmd, + {"parms", irParmsTstCmd, "print internal data structures", - "parms", + "parms"}, - 0 - }, *irTestCmdP; + {0} +}, *irTestCmdP; /* diff --git a/lef/defRead.c b/lef/defRead.c index 6f0f9eb3..c2753d1b 100644 --- a/lef/defRead.c +++ b/lef/defRead.c @@ -1357,7 +1357,7 @@ DefReadLocation(use, f, oscale, tptr, noplace) char *propval; bool found; - propval = DBPropGet(use->cu_def, "FIXED_BBOX", &found); + propval = (char *)DBPropGet(use->cu_def, "FIXED_BBOX", &found); if (found) { if (sscanf(propval, "%d %d %d %d", &rect.r_xbot, &rect.r_ybot, diff --git a/lef/defWrite.c b/lef/defWrite.c index 907f9acb..4ae81f73 100644 --- a/lef/defWrite.c +++ b/lef/defWrite.c @@ -330,7 +330,7 @@ defnodeCount(node, res, cap, total) if (pwr && (!strcmp(cp, pwr))) { /* Diagnostic */ - TxPrintf("Node %s matches VDD variable definition!\n"); + TxPrintf("Node %s matches VDD variable definition!\n", cp); node->efnode_flags |= EF_SPECIAL; } @@ -338,7 +338,7 @@ defnodeCount(node, res, cap, total) if (pwr && (!strcmp(cp, pwr))) { /* Diagnostic */ - TxPrintf("Node %s matches GND variable definition!\n"); + TxPrintf("Node %s matches GND variable definition!\n", cp); node->efnode_flags |= EF_SPECIAL; } @@ -412,7 +412,7 @@ defHNsprintf(str, hierName, divchar) /* (which are interpreted as wildcard characters by LEF/DEF). */ cp = hierName->hn_name; - while (c = *cp++) + while ((c = *cp++)) { switch (c) { @@ -441,10 +441,10 @@ char *defHNsprintfPrefix(hierName, str, divchar) char *cp, c; if (hierName->hn_parent) - str = defHNsprintfPrefix(hierName->hn_parent, str); + str = defHNsprintfPrefix(hierName->hn_parent, str, divchar); cp = hierName->hn_name; - while (*str++ = *cp++) ; + while ((*str++ = *cp++)) ; *(--str) = divchar; return ++str; } @@ -531,7 +531,7 @@ defWriteRouteWidth(defdata, width) int width; { float oscale = defdata->scale; - char numstr[12]; + char numstr[32]; sprintf(numstr, "%.10g", ((float)width * defdata->scale)); defCheckForBreak(strlen(numstr) + 1, defdata); fprintf(defdata->f, "%s ", numstr); @@ -564,7 +564,7 @@ defWriteCoord(defdata, x, y, orient) unsigned char orient; { FILE *f = defdata->f; - char numstr[12]; + char numstr[32]; int ctot = 4; /* The "12" here is just a fudge factor; it is not crucial */ @@ -2036,7 +2036,7 @@ defGetType(ttype, lefptr, do_vias) if (LefInfo.ht_table != (HashEntry **) NULL) { HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (lefl && (do_vias == FALSE) && (contact == CLASS_VIA) && @@ -2101,7 +2101,7 @@ defWriteVias(f, rootDef, oscale, lefMagicToLefLayer) cscale = CIFGetOutputScale(1); HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { int size, sep, border; char *us1, *us2; @@ -2285,8 +2285,7 @@ defCountCompFunc(cellUse, total) int sy = cellUse->cu_yhi - cellUse->cu_ylo + 1; // TxPrintf("Diagnostic: cell %s %d %d\n", cellUse->cu_id, sx, sy); ASSERT(sx >= 0 && sy >= 0, "Valid array"); - - (*total) += sx * sy; /* Increment the count of uses */ + (*total) += (unsigned long)sx * sy; /* Increment the count of uses */ return 0; /* Keep the search going */ } @@ -2476,7 +2475,7 @@ defWriteBlockages(f, rootDef, oscale, MagicToLefTable) if (LefInfo.ht_table != (HashEntry **) NULL) { HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (lefl != NULL) @@ -2496,7 +2495,7 @@ defWriteBlockages(f, rootDef, oscale, MagicToLefTable) { numblocks = 0; HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if ((lefl != NULL) && ((lefl->lefClass == CLASS_ROUTE) || @@ -2773,7 +2772,7 @@ arrayDefFunc(use, transform, x, y, defdata) char *propval; bool found; - propval = DBPropGet(use->cu_def, "FIXED_BBOX", &found); + propval = (char *)DBPropGet(use->cu_def, "FIXED_BBOX", &found); if (found) { if (sscanf(propval, "%d %d %d %d", &rect.r_xbot, &rect.r_ybot, @@ -2831,7 +2830,7 @@ defComponentFunc(cellUse, defdata) char *propval; bool found; - propval = DBPropGet(cellUse->cu_def, "FIXED_BBOX", &found); + propval = (char *)DBPropGet(cellUse->cu_def, "FIXED_BBOX", &found); if (found) { if (sscanf(propval, "%d %d %d %d", &rect.r_xbot, &rect.r_ybot, @@ -3064,7 +3063,7 @@ DefWriteCell(def, outName, allSpecial, units, analRetentive) fprintf(f, "NONDEFAULTRULES %d ;\n", numrules); HashStartSearch(&hs); - while (he = HashNext(&LefNonDefaultRules, &hs)) + while ((he = HashNext(&LefNonDefaultRules, &hs))) { nrules = (LefRules *)HashGetValue(he); fprintf(f, " - %s", nrules->name); @@ -3082,7 +3081,7 @@ DefWriteCell(def, outName, allSpecial, units, analRetentive) lefLayer *lefl2; HashStartSearch(&hs2); - while (he2 = HashNext(&LefInfo, &hs2)) + while ((he2 = HashNext(&LefInfo, &hs2))) { lefl2 = (lefLayer *)HashGetValue(he2); if (lefl2->lefClass == CLASS_ROUTE) @@ -3109,7 +3108,7 @@ DefWriteCell(def, outName, allSpecial, units, analRetentive) /* Put the reference counts back to the way they were */ HashStartSearch(&hs2); - while (he2 = HashNext(&LefInfo, &hs2)) + while ((he2 = HashNext(&LefInfo, &hs2))) { lefl2 = (lefLayer *)HashGetValue(he2); if (lefl2->refCnt < 0) diff --git a/lef/lefCmd.c b/lef/lefCmd.c index 3ae84132..94650f68 100644 --- a/lef/lefCmd.c +++ b/lef/lefCmd.c @@ -12,6 +12,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include #include "tcltk/tclmagic.h" diff --git a/lef/lefRead.c b/lef/lefRead.c index f1206c78..de347c11 100644 --- a/lef/lefRead.c +++ b/lef/lefRead.c @@ -21,6 +21,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include #include #include @@ -648,7 +649,7 @@ LefRedefined(lefl, redefname) records = 0; altName = NULL; HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { slef = (lefLayer *)HashGetValue(he); if (slef == lefl) @@ -1331,7 +1332,7 @@ LefReadGeometry(lefMacro, f, oscale, do_list, is_imported) rectList = rectNew; if ((!do_list) && (otherlayer != -1)) - LefPaintPolygon(lefMacro, pointList, points, otherlayer); + LefPaintPolygon(lefMacro, pointList, points, otherlayer, FALSE); } freeMagic(pointList); } diff --git a/lef/lefTech.c b/lef/lefTech.c index 16644e16..48e49ca7 100644 --- a/lef/lefTech.c +++ b/lef/lefTech.c @@ -104,7 +104,7 @@ LefTechInit() if (LefInfo.ht_table != (HashEntry **) NULL) { HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (!lefl) continue; @@ -157,7 +157,7 @@ lefRemoveGeneratedVias() if (LefInfo.ht_table != (HashEntry **) NULL) { HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (!lefl) continue; @@ -423,7 +423,7 @@ LefTechScale(scalen, scaled) if (LefInfo.ht_table != (HashEntry **) NULL) { HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (!lefl) continue; @@ -450,7 +450,7 @@ LefTechScale(scalen, scaled) /* Return all refCnt values to normal */ HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (!lefl) continue; @@ -483,7 +483,7 @@ LefTechSetDefaults() if (LefInfo.ht_table != (HashEntry **) NULL) { HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (!lefl) continue; @@ -504,9 +504,9 @@ LefTechSetDefaults() } else if (lefl->lefClass == CLASS_ROUTE) { - if (lefl->info.route.width = -1) + if (lefl->info.route.width == -1) lefl->info.route.width = DRCGetDefaultLayerWidth(lefl->type); - if (lefl->info.route.spacing = -1) + if (lefl->info.route.spacing == -1) lefl->info.route.width = DRCGetDefaultLayerSpacing(lefl->type, lefl->type); } diff --git a/lef/lefWrite.c b/lef/lefWrite.c index 93657b18..024fdf2a 100644 --- a/lef/lefWrite.c +++ b/lef/lefWrite.c @@ -187,7 +187,7 @@ lefFileOpen(def, file, suffix, mode, prealfile) else ends++; - if (endp = strrchr(ends, '.')) + if ((endp = strrchr(ends, '.'))) { if (strcmp(endp, suffix)) { @@ -300,7 +300,7 @@ lefWriteHeader(def, f, lefTech, propTable, siteTable) HashStartSearch(&hs); nprops = 0; - while (he = HashNext(propTable, &hs)) + while ((he = HashNext(propTable, &hs))) { if (nprops == 0) fprintf(f, "PROPERTYDEFINITIONS\n"); nprops++; @@ -312,7 +312,7 @@ lefWriteHeader(def, f, lefTech, propTable, siteTable) if (nprops > 0) fprintf(f, "END PROPERTYDEFINITIONS\n\n"); HashStartSearch(&hs); - while (he = HashNext(siteTable, &hs)) + while ((he = HashNext(siteTable, &hs))) { /* Output the SITE as a macro */ CellDef *siteDef; @@ -374,7 +374,7 @@ lefWriteHeader(def, f, lefTech, propTable, siteTable) float oscale = CIFGetOutputScale(1000); /* lambda->micron conversion */ HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (!lefl) continue; @@ -436,7 +436,7 @@ lefWriteHeader(def, f, lefTech, propTable, siteTable) /* Return reference counts to normal */ HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefl = (lefLayer *)HashGetValue(he); if (lefl && lefl->refCnt < 0) @@ -1219,7 +1219,7 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) TTMaskSetType(&lc.rmask, lab->lab_type); HashStartSearch(&hs); - while (he = HashNext(&LefInfo, &hs)) + while ((he = HashNext(&LefInfo, &hs))) { lefLayer *lefl = (lefLayer *)HashGetValue(he); if (lefl && (lefl->lefClass == CLASS_ROUTE || lefl->lefClass == CLASS_VIA @@ -1591,8 +1591,10 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) /* disappear by being inside the setback area. */ pNum = DBPlane(lab->lab_type); - DBPaintPlane(SelectDef->cd_planes[pNum], &labr, - DBStdPaintTbl(lab->lab_type, pNum), (PaintUndoInfo *) NULL); + if (pNum >= 0) // ignore labels in space + DBPaintPlane(SelectDef->cd_planes[pNum], &labr, + DBStdPaintTbl(lab->lab_type, pNum), + (PaintUndoInfo *) NULL); } else { @@ -1607,8 +1609,10 @@ lefWriteMacro(def, f, scale, setback, pinonly, toplayer, domaster) /* disappear by being inside the setback area. */ pNum = DBPlane(lab->lab_type); - DBPaintPlane(SelectDef->cd_planes[pNum], &labr, - DBStdPaintTbl(lab->lab_type, pNum), (PaintUndoInfo *) NULL); + if (pNum >= 0) // ignore labels in space + DBPaintPlane(SelectDef->cd_planes[pNum], &labr, + DBStdPaintTbl(lab->lab_type, pNum), + (PaintUndoInfo *) NULL); } } @@ -2243,7 +2247,7 @@ LefWriteAll(rootUse, writeTopCell, lefTech, lefHide, lefPinOnly, lefTopLayer, HashKill(&propHashTbl); HashKill(&siteHashTbl); - while (def = (CellDef *) StackPop(lefDefStack)) + while ((def = (CellDef *) StackPop(lefDefStack))) { def->cd_client = (ClientData) 0; if (!SigInterruptPending) diff --git a/mzrouter/mzDebug.c b/mzrouter/mzDebug.c index 2b440a1f..5f32f0ff 100644 --- a/mzrouter/mzDebug.c +++ b/mzrouter/mzDebug.c @@ -22,6 +22,7 @@ static char rcsid[] __attribute__ ((unused)) = "$$"; #endif /* not lint */ #include +#include #include "utils/magic.h" #include "utils/signals.h" @@ -540,8 +541,8 @@ mzDumpTagsFunc(tile, cxp) TITORECT(tile, &r); /* print tile bounds */ - TxPrintf("tile %x (x: %d to %d, y: %d to %d)\n", - (pointertype) tile, r.r_xbot, r.r_xtop, r.r_ybot, r.r_ytop); + TxPrintf("tile %lx (x: %d to %d, y: %d to %d)\n", + (intmax_t) (pointertype) tile, r.r_xbot, r.r_xtop, r.r_ybot, r.r_ytop); /* dump rects attached to client field */ { diff --git a/mzrouter/mzEstimate.c b/mzrouter/mzEstimate.c index 2f014f44..d32e8fd7 100644 --- a/mzrouter/mzEstimate.c +++ b/mzrouter/mzEstimate.c @@ -91,6 +91,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include "utils/magic.h" #include "utils/geometry.h" @@ -1998,8 +1999,8 @@ mzDumpEstFunc(tile, fd) } else { - TxPrintf("\ntile %x\t\t (x: %d to %d, y: %d to %d)\n", - (pointertype) tile, r.r_xbot, r.r_xtop, r.r_ybot, r.r_ytop); + TxPrintf("\ntile %lx\t\t (x: %d to %d, y: %d to %d)\n", + (intmax_t) tile, r.r_xbot, r.r_xtop, r.r_ybot, r.r_ytop); TxPrintf("\thcost = %d, ", tilec->tc_hCost); TxPrintf("vcost = %d \n", diff --git a/mzrouter/mzInit.c b/mzrouter/mzInit.c index 7dce9c84..2cbaec5d 100644 --- a/mzrouter/mzInit.c +++ b/mzrouter/mzInit.c @@ -111,9 +111,9 @@ MZInit() char *di_name; int *di_id; } dflags[] = { - "steppath", &mzDebStep, - "maze", &mzDebMaze, - 0 + {"steppath", &mzDebStep}, + {"maze", &mzDebMaze}, + {0} }; /* Register with debug module */ diff --git a/mzrouter/mzMain.c b/mzrouter/mzMain.c index c877e8ab..f2e4637b 100644 --- a/mzrouter/mzMain.c +++ b/mzrouter/mzMain.c @@ -233,22 +233,22 @@ bool mzPathsDirty = FALSE; /* macro for adding address pairs to translation table */ #define ADDR_TBL_EQUIV(a1,a2) \ -if(TRUE) \ +do \ { \ HashSetValue(HashFind(&aT, (char *) (a1)), (char *) (a2)); \ HashSetValue(HashFind(&aT, (char *) (a2)), (char *) (a1)); \ -} else +} while(0) /* macro for translating address to address paired with it in address table */ #define ADDR_TBL(type,a) \ -if (TRUE) \ +do \ { \ HashEntry *he = HashLookOnly(&aT, (char *) (a)); \ if(he) \ { \ a = (type) HashGetValue(he); \ } \ -} else +} while(0) /* diff --git a/mzrouter/mzTech.c b/mzrouter/mzTech.c index dc7a595c..d65d5651 100644 --- a/mzrouter/mzTech.c +++ b/mzrouter/mzTech.c @@ -817,8 +817,8 @@ mzTechSpacing(argc, argv) char *sT_name; /* name of value */ int sT_value; /* corresponding interger value */ } subcellTable[] = { - "subcell", TT_SUBCELL, - 0 + {"subcell", TT_SUBCELL}, + {0} }; /* check number of arguments */ diff --git a/mzrouter/mzTestCmd.c b/mzrouter/mzTestCmd.c index d6c4b5a1..526d291b 100644 --- a/mzrouter/mzTestCmd.c +++ b/mzrouter/mzTestCmd.c @@ -537,40 +537,40 @@ mzVersionCmd(w, cmd) /*--------------------------- Command Table ------------------------------ */ TestCmdTableE mzTestCommands[] = { - "debug", mzDebugTstCmd, + {"debug", mzDebugTstCmd, "set or clear debug flags", - "debug [flag] [value]", + "debug [flag] [value]"}, - "dumpEstimates", mzDumpEstimatesTstCmd, + {"dumpEstimates", mzDumpEstimatesTstCmd, "print global estimate info for tiles under box", - "dumpEstimates", + "dumpEstimates"}, - "dumpTags", mzDumpTagsTstCmd, + {"dumpTags", mzDumpTagsTstCmd, "print tag info on data tiles under box", - "dumpTags", + "dumpTags"}, - "help", mzHelpTstCmd, + {"help", mzHelpTstCmd, "summarize *mzroute subcommands", - "help [subcommand]", + "help [subcommand]"}, - "numberLine", mzNumberLineTstCmd, + {"numberLine", mzNumberLineTstCmd, "exercise numberline code", - "numberLine", + "numberLine"}, - "parms", mzParmsTstCmd, + {"parms", mzParmsTstCmd, "print internal data structures", - "parms", + "parms"}, - "plane", mzPlaneTstCmd, + {"plane", mzPlaneTstCmd, "make internal tile plane visible", - "plane [plane]", + "plane [plane]"}, - "version", mzVersionCmd, + {"version", mzVersionCmd, "identify mzrouter version", - "version", + "version"}, - 0 - }, *mzTestCmdP; + {0} +}, *mzTestCmdP; void MZTest(w, cmd) diff --git a/net2ir/net2ir.c b/net2ir/net2ir.c index 4410be6c..42500ea7 100644 --- a/net2ir/net2ir.c +++ b/net2ir/net2ir.c @@ -120,7 +120,7 @@ getfirst: continue; } - if (cp = strchr(line1, '\n')) + if ((cp = strchr(line1, '\n'))) *cp = '\0'; if (nterms >= 2) diff --git a/netmenu/NMbutton.c b/netmenu/NMbutton.c index 723a6c4b..43d40308 100644 --- a/netmenu/NMbutton.c +++ b/netmenu/NMbutton.c @@ -79,7 +79,7 @@ NMButtonNetList(window, cmd, nmButton, point) else { TxPrintf("New net list name: "); - if (TxGetLine(newName, MAXLENGTH) == NULL) newName[0] == 0; + if (TxGetLine(newName, MAXLENGTH) == NULL) newName[0] = 0; if (newName[0] == 0) return; NMNewNetlist(newName); } diff --git a/netmenu/NMmain.c b/netmenu/NMmain.c index 6c23b816..9694a16e 100644 --- a/netmenu/NMmain.c +++ b/netmenu/NMmain.c @@ -59,46 +59,46 @@ extern void nmNotDefined(); NetButton NMButtons[] = { - NULL, STYLE_ORANGE1, 0, 200, 80, 210, - NMGetLabels, NULL, NMNextLabel, NULL, NMNextLabel, NULL, - NULL, STYLE_ERASEALL, 0, 174, 24, 198, - NMPutLabel, NULL, NMReOrientLabel, NULL, NMReOrientLabel, NULL, - NULL, STYLE_ORANGE1, 42, 188, 59, 198, - NMChangeNum, NULL, NMChangeNum, NULL, NMChangeNum, NULL, - NULL, STYLE_ORANGE1, 63, 188, 80, 198, - NMChangeNum, NULL, NMChangeNum, NULL, NMChangeNum, NULL, - "Find", STYLE_ORANGE2, 42, 174, 80, 184, - NMFindLabel, NULL, NMFindLabel, NULL, NMFindLabel, NULL, - NULL, STYLE_GREEN1, 0, 150, 80, 160, - NMButtonNetList, NULL, NMButtonNetList, NULL, NMButtonNetList, NULL, - "Verify", STYLE_BLUE1, 0, 138, 38, 148, - NMCmdVerify, NULL, NMCmdVerify, NULL, NMCmdVerify, NULL, - "Print", STYLE_BLUE2, 42, 138, 80, 148, - NMCmdPrint, NULL, NMCmdPrint, NULL, NMCmdPrint, NULL, - "Terms", STYLE_RED1, 0, 126, 38, 136, - NMCmdShowterms, NULL, NMCmdShowterms, NULL, NMCmdShowterms, NULL, - "Cleanup", STYLE_RED2, 42, 126, 80, 136, - NMCmdCleanup, NULL, NMCmdCleanup, NULL, NMCmdCleanup, NULL, - "No Net",STYLE_GRAY1, 0, 114, 38, 124, - NMCmdDnet, NULL, NMCmdDnet, NULL, NMCmdDnet, NULL, - "Show",STYLE_YELLOW1, 42, 114, 80, 124, - NMShowUnderBox, NULL, NMShowUnderBox, NULL, NMShowUnderBox, NULL, - NULL, -1 /* -1 Signals end of list. */ + {NULL, STYLE_ORANGE1, {{0, 200}, {80, 210}}, + NMGetLabels, NULL, NMNextLabel, NULL, NMNextLabel, NULL}, + {NULL, STYLE_ERASEALL, {{0, 174}, {24, 198}}, + NMPutLabel, NULL, NMReOrientLabel, NULL, NMReOrientLabel, NULL}, + {NULL, STYLE_ORANGE1, {{42, 188}, {59, 198}}, + NMChangeNum, NULL, NMChangeNum, NULL, NMChangeNum, NULL}, + {NULL, STYLE_ORANGE1, {{63, 188}, {80, 198}}, + NMChangeNum, NULL, NMChangeNum, NULL, NMChangeNum, NULL}, + {"Find", STYLE_ORANGE2, {{42, 174}, {80, 184}}, + NMFindLabel, NULL, NMFindLabel, NULL, NMFindLabel, NULL}, + {NULL, STYLE_GREEN1, {{0, 150}, {80, 160}}, + NMButtonNetList, NULL, NMButtonNetList, NULL, NMButtonNetList, NULL}, + {"Verify", STYLE_BLUE1, {{0, 138}, {38, 148}}, + NMCmdVerify, NULL, NMCmdVerify, NULL, NMCmdVerify, NULL}, + {"Print", STYLE_BLUE2, {{42, 138}, {80, 148}}, + NMCmdPrint, NULL, NMCmdPrint, NULL, NMCmdPrint, NULL}, + {"Terms", STYLE_RED1, {{0, 126}, {38, 136}}, + NMCmdShowterms, NULL, NMCmdShowterms, NULL, NMCmdShowterms, NULL}, + {"Cleanup", STYLE_RED2, {{42, 126}, {80, 136}}, + NMCmdCleanup, NULL, NMCmdCleanup, NULL, NMCmdCleanup, NULL}, + {"No Net",STYLE_GRAY1, {{0, 114}, {38, 124}}, + NMCmdDnet, NULL, NMCmdDnet, NULL, NMCmdDnet, NULL}, + {"Show",STYLE_YELLOW1, {{42, 114}, {80, 124}}, + NMShowUnderBox, NULL, NMShowUnderBox, NULL, NMShowUnderBox, NULL}, + {NULL, -1 /* -1 Signals end of list. */ } }; NetLabel nmLabels[] = { - "Label", STYLE_WHITE, 0, 212, 80, 222, - "Netlist", STYLE_WHITE, 0, 162, 80, 172, - NULL, -1 /* -1 signals end of list. */ + {"Label", STYLE_WHITE, {{0, 212}, {80, 222}}}, + {"Netlist", STYLE_WHITE, {{0, 162}, {80, 172}}}, + {NULL, -1 /* -1 signals end of list. */ } }; NetRect nmRects[] = { - STYLE_BBOX, 8, 174, 16, 198, - STYLE_BBOX, 0, 182, 24, 190, - STYLE_BBOX, 12, 186, 12, 186, - -1 /* -1 signals end of list. */ + {STYLE_BBOX, {{8, 174}, {16, 198}}}, + {STYLE_BBOX, {{0, 182}, {24, 190}}}, + {STYLE_BBOX, {{12, 186}, {12, 186}}}, + {-1 /* -1 signals end of list. */ } }; @@ -106,8 +106,8 @@ NetRect nmRects[] = * netlist menu, and the initial screen location of netlist menus. */ -Rect nmSurfaceArea = {-4, 110, 84, 226}; -Rect nmScreenArea = {0, 0, 140, 190}; +Rect nmSurfaceArea = {{-4, 110}, {84, 226}}; +Rect nmScreenArea = {{0, 0}, {140, 190}}; /* Only one netlist window is allowed to be open at once. This is it. */ diff --git a/netmenu/NMnetlist.c b/netmenu/NMnetlist.c index 0cd505a5..26072dd0 100644 --- a/netmenu/NMnetlist.c +++ b/netmenu/NMnetlist.c @@ -23,6 +23,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include +#include #include "utils/magic.h" #include "utils/utils.h" diff --git a/plot/plotHP.c b/plot/plotHP.c index 76e08bab..e2c6de54 100644 --- a/plot/plotHP.c +++ b/plot/plotHP.c @@ -332,15 +332,15 @@ PlotDumpHPRTL(hpfile, kRaster, cRaster, mRaster, yRaster) /* Compress each plane (C, M, and Y) and output */ - size = PlotRTLCompress(c - ipl, obytes, bpl); + size = PlotRTLCompress((unsigned char *)(c - ipl), obytes, bpl); fprintf(hpfile, "\033*b%dV", size); fwrite(obytes, size, 1, hpfile); - size = PlotRTLCompress(m - ipl, obytes, bpl); + size = PlotRTLCompress((unsigned char *)(m - ipl), obytes, bpl); fprintf(hpfile, "\033*b%dV", size); fwrite(obytes, size, 1, hpfile); - size = PlotRTLCompress(y - ipl, obytes, bpl); + size = PlotRTLCompress((unsigned char *)(y - ipl), obytes, bpl); fprintf(hpfile, "\033*b%dW", size); fwrite(obytes, size, 1, hpfile); } diff --git a/plot/plotPNM.c b/plot/plotPNM.c index 4e2a29a4..be620121 100644 --- a/plot/plotPNM.c +++ b/plot/plotPNM.c @@ -518,7 +518,7 @@ pnmTile (tile, cxp) col = PaintStyles[type].color; t = rtile + x + ds_xsize * y; - for (dy; dy > 0; dy--) + for ( ; dy > 0; dy--) { for (j = 0; j < dx; j++) { @@ -582,7 +582,7 @@ PlotPNM(fileName, scx, layers, xMask, width) int i, x, y, tile_ydelta; int save_ds, iter; int scale_over_2, ds_over_2; - float *strip; + float *strip = NULL; float scale, invscale, scaledown, normal; #ifdef VERSATEC @@ -877,7 +877,7 @@ PlotPNM(fileName, scx, layers, xMask, width) /* Clear tile memory with the background gray level */ memset((void *)rtile, PlotPNMBG, - (size_t)(ds_xsize * ds_ysize * PIXELSZ)); + (size_t)ds_xsize * ds_ysize * PIXELSZ); if (SigInterruptPending) { @@ -937,8 +937,10 @@ PlotPNM(fileName, scx, layers, xMask, width) done: PlotPNMdownsample = save_ds; freeMagic(rtile); + rtile = NULL; freeMagic(strip); freeMagic(lkstep); + lkstep = NULL; return; } diff --git a/plot/plotRutils.c b/plot/plotRutils.c index 821567a5..8b4b22ee 100644 --- a/plot/plotRutils.c +++ b/plot/plotRutils.c @@ -231,7 +231,7 @@ PlotClearRaster(raster, area) if (area == NULL) { bzero((char *) raster->ras_bits, - raster->ras_bytesPerLine * raster->ras_height); + (size_t)raster->ras_bytesPerLine * raster->ras_height); return; } @@ -519,7 +519,7 @@ PlotDumpRaster(raster, file) int count; count = write(fileno(file), (char *) raster->ras_bits, - raster->ras_bytesPerLine*raster->ras_height); + (size_t)raster->ras_bytesPerLine * raster->ras_height); if (count < 0) { TxError("I/O error in writing raster file: %s.\n", @@ -710,7 +710,7 @@ PlotTextSize(font, string, area) { if ((*string == ' ') || (*string == '\t')) d = &font->fo_chars['t']; - else d = &font->fo_chars[*string]; + else d = &font->fo_chars[(unsigned char)*string]; if (d->nbytes == 0) continue; if (d->up > area->r_ytop) area->r_ytop = d->up; @@ -783,7 +783,7 @@ PlotRasterText(raster, clip, font, string, point) * area of the raster. */ - d = &font->fo_chars[*string]; + d = &font->fo_chars[(unsigned char)*string]; cBytesPerLine = (d->left + d->right + 7) >> 3; for (i = 0; i < d->up + d->down; i++) { diff --git a/plot/plotVers.c b/plot/plotVers.c index d9e55ad5..f5698e1d 100644 --- a/plot/plotVers.c +++ b/plot/plotVers.c @@ -408,15 +408,15 @@ PlotColorVersTechLine(sectionName, argc, argv) { VersatecStyle *new; static struct { char *l_str; int l_color; } colors[] = { - "black", BLACK, - "cyan", CYAN, - "magenta", MAGENTA, - "yellow", YELLOW, - "K", BLACK, - "C", CYAN, - "M", MAGENTA, - "Y", YELLOW, - 0 + {"black", BLACK}, + {"cyan", CYAN}, + {"magenta", MAGENTA}, + {"yellow", YELLOW}, + {"K", BLACK}, + {"C", CYAN}, + {"M", MAGENTA}, + {"Y", YELLOW}, + {0} }; int i; diff --git a/plow/PlowRandom.c b/plow/PlowRandom.c index f77b4f22..89afa018 100644 --- a/plow/PlowRandom.c +++ b/plow/PlowRandom.c @@ -294,7 +294,7 @@ plowFileDiff(file1, file2) char *file2; { char b1[BUFSIZ], b2[BUFSIZ]; - int f1, f2; + int f1 = -1, f2 = -1; int n1, n2; bool ret = FALSE; @@ -310,7 +310,9 @@ plowFileDiff(file1, file2) ret = TRUE; done: - (void) close(f1); - (void) close(f2); + if (f1 >= 0) + (void) close(f1); + if (f2 >= 0) + (void) close(f2); return (ret); } diff --git a/plow/PlowRules1.c b/plow/PlowRules1.c index 4e0ba98c..0dfb8fdb 100644 --- a/plow/PlowRules1.c +++ b/plow/PlowRules1.c @@ -436,7 +436,7 @@ plowPenumbraRule(impactedEdge, ar) int newsep, oldsep, newx; oldsep = impactedEdge->e_x - movingEdge->e_x; - if (pr = ar->ar_rule) + if ((pr = ar->ar_rule)) { if (!TTMaskHasType(&pr->pr_oktypes, impactedEdge->e_ltype)) return (0); diff --git a/plow/PlowTech.c b/plow/PlowTech.c index c2292667..7ebabe89 100644 --- a/plow/PlowTech.c +++ b/plow/PlowTech.c @@ -182,11 +182,11 @@ PlowDRCLine(sectionName, argc, argv) int rk_maxargs; /* Max # arguments */ int (*rk_proc)(); /* Procedure implementing this keyword */ } ruleKeys[] = { - "edge", 8, 9, plowEdgeRule, - "edge4way", 8, 9, plowEdgeRule, - "spacing", 6, 6, plowSpacingRule, - "width", 4, 4, plowWidthRule, - 0 + {"edge", 8, 9, plowEdgeRule}, + {"edge4way", 8, 9, plowEdgeRule}, + {"spacing", 6, 6, plowSpacingRule}, + {"width", 4, 4, plowWidthRule}, + {0} }, *rp; /* @@ -642,14 +642,14 @@ PlowDRCFinal() plowMaxDist[i] = 0; for (j = 0; j < DBNumTypes; j++) { - if (pr = plowWidthRulesTbl[i][j]) + if ((pr = plowWidthRulesTbl[i][j])) { pr = plowWidthRulesTbl[i][j] = plowTechOptimizeRule(pr); for ( ; pr; pr = pr->pr_next) if (pr->pr_dist > plowMaxDist[i]) plowMaxDist[i] = pr->pr_dist; } - if (pr = plowSpacingRulesTbl[i][j]) + if ((pr = plowSpacingRulesTbl[i][j])) { pr = plowSpacingRulesTbl[i][j] = plowTechOptimizeRule(pr); for ( ; pr; pr = pr->pr_next) @@ -1016,7 +1016,7 @@ plowTechShowTable(table, header, f) fprintf(f, "\n\n------------ %s ------------\n", header); for (i = 0; i < DBNumTypes; i++) for (j = 0; j < DBNumTypes; j++) - if (pr = table[i][j]) + if ((pr = table[i][j])) { fprintf(f, "\n%s -- %s:\n", DBTypeLongName(i), DBTypeLongName(j)); diff --git a/plow/PlowTest.c b/plow/PlowTest.c index 9da0b126..48e5a65a 100644 --- a/plow/PlowTest.c +++ b/plow/PlowTest.c @@ -105,28 +105,28 @@ struct pCmd p_cmd; char *p_help; } plowCmds[] = { - "clrdebug", PC_CLRD, "flags", - "help", PC_HELP, "", - "jogreduce", PC_JOG, "", - "lwidth", PC_LWIDTH, "layers", - "lshadow", PC_LSHADOW, "layers", - "mergedown", PC_MERGEDOWN, "", - "mergeup", PC_MERGEUP, "", - "move", PC_MOVE, "", - "outline", PC_OUTLINE, "direction layers", - "plow", PC_PLOW, "direction [layers]", - "print", PC_PRINT, "", - "random", PC_RANDOM, "", - "setdebug", PC_SETD, "flags", - "shadow", PC_SHADOW, "layers", - "showdebug", PC_SHOWD, "", - "split", PC_SPLIT, "", - "techshow", PC_TECHSHOW, "[file]", - "trail", PC_TRAIL, "[value]", - "whenbot", PC_WHENBOT, "[xbot ybot]", - "whentop", PC_WHENTOP, "[xtop ytop]", - "width", PC_WIDTH, "layers", - 0, + {"clrdebug", PC_CLRD, "flags"}, + {"help", PC_HELP, ""}, + {"jogreduce", PC_JOG, ""}, + {"lwidth", PC_LWIDTH, "layers"}, + {"lshadow", PC_LSHADOW, "layers"}, + {"mergedown", PC_MERGEDOWN, ""}, + {"mergeup", PC_MERGEUP, ""}, + {"move", PC_MOVE, ""}, + {"outline", PC_OUTLINE, "direction layers"}, + {"plow", PC_PLOW, "direction [layers]"}, + {"print", PC_PRINT, ""}, + {"random", PC_RANDOM, ""}, + {"setdebug", PC_SETD, "flags"}, + {"shadow", PC_SHADOW, "layers"}, + {"showdebug", PC_SHOWD, ""}, + {"split", PC_SPLIT, ""}, + {"techshow", PC_TECHSHOW, "[file]"}, + {"trail", PC_TRAIL, "[value]"}, + {"whenbot", PC_WHENBOT, "[xbot ybot]"}, + {"whentop", PC_WHENTOP, "[xtop ytop]"}, + {"width", PC_WIDTH, "layers"}, + {0}, }; void @@ -162,6 +162,8 @@ PlowTest(w, cmd) for (n = 0; plowCmds[n].p_name; n++) TxPrintf("%-15s %s\n", plowCmds[n].p_name, plowCmds[n].p_help); break; + case PC_ERROR: /* exhaustive switch on enum compiler warning */ + break; case PC_RANDOM: PlowRandomTest(def); break; @@ -307,8 +309,8 @@ PlowTest(w, cmd) tp = TiSrPointNoHint(plane, &editArea.r_ll); if (cmd->tx_argc == 3) trail = atoi(cmd->tx_argv[2]); else trail = editArea.r_xtop; - TxPrintf("Trailing coordinate of tile 0x%x updated from %d to %d\n", - tp, TRAILING(tp), trail); + TxPrintf("Trailing coordinate of tile %p updated from %d to %d\n", + (void *)tp, TRAILING(tp), trail); plowSetTrailing(tp, trail); break; case PC_MOVE: @@ -328,13 +330,13 @@ PlowTest(w, cmd) return; } TiToRect(tp, &area2); - TxPrintf("Splitting tile 0x%x at y=%d yielding 0x%x\n", - tp, editArea.r_ybot, plowSplitY(tp, editArea.r_ybot)); + TxPrintf("Splitting tile %p at y=%d yielding %p\n", + (void *)tp, editArea.r_ybot, (void *)plowSplitY(tp, editArea.r_ybot)); DBWAreaChanged(def, &area2, DBW_ALLWINDOWS, &DBAllButSpaceBits); break; case PC_MERGEDOWN: tp = TiSrPointNoHint(plane, &editArea.r_ll); - TxPrintf("Merging tile 0x%x below\n", tp); + TxPrintf("Merging tile %p below\n", tp); TiToRect(tp, &editArea); TiToRect(RT(tp), &area2); (void) GeoInclude(&area2, &editArea); @@ -343,7 +345,7 @@ PlowTest(w, cmd) break; case PC_MERGEUP: tp = TiSrPointNoHint(plane, &editArea.r_ll); - TxPrintf("Merging tile 0x%x above\n", tp); + TxPrintf("Merging tile %p above\n", tp); TiToRect(tp, &editArea); TiToRect(RT(tp), &area2); (void) GeoInclude(&area2, &editArea); @@ -352,7 +354,7 @@ PlowTest(w, cmd) break; case PC_PRINT: tp = TiSrPointNoHint(plane, &editArea.r_ll); - TxPrintf("Tile 0x%x LEFT=%d RIGHT=%d BOTTOM=%d TOP=%d\n", + TxPrintf("Tile %p LEFT=%d RIGHT=%d BOTTOM=%d TOP=%d\n", tp, LEFT(tp), RIGHT(tp), BOTTOM(tp), TOP(tp)); TxPrintf(" TRAILING=%d LEADING=%d TYPE=%s\n", TRAILING(tp), LEADING(tp), DBTypeLongName(TiGetTypeExact(tp))); @@ -457,14 +459,14 @@ plowDebugInit() char *di_name; int *di_id; } debug[] = { - "addedge", &plowDebAdd, - "jogs", &plowDebJogs, - "moveedge", &plowDebMove, - "nextedge", &plowDebNext, - "time", &plowDebTime, - "width", &plowDebWidth, - "yankall", &plowDebYankAll, - 0 + {"addedge", &plowDebAdd}, + {"jogs", &plowDebJogs}, + {"moveedge", &plowDebMove}, + {"nextedge", &plowDebNext}, + {"time", &plowDebTime}, + {"width", &plowDebWidth}, + {"yankall", &plowDebYankAll}, + {0} }; /* Register ourselves with the debugging module */ diff --git a/readline/readline-4.3/display.c b/readline/readline-4.3/display.c index 83f12f26..ab6e39b1 100644 --- a/readline/readline-4.3/display.c +++ b/readline/readline-4.3/display.c @@ -21,6 +21,8 @@ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ #define READLINE_LIBRARY +#define _XOPEN_SOURCE /* See feature_test_macros(7) */ + #if defined (HAVE_CONFIG_H) # include #endif @@ -41,7 +43,6 @@ #include -#define _XOPEN_SOURCE /* See feature_test_macros(7) */ #include /* System-specific feature definitions and include files. */ diff --git a/readline/readline-4.3/mbutil.c b/readline/readline-4.3/mbutil.c index 397c22a6..32cbee1f 100644 --- a/readline/readline-4.3/mbutil.c +++ b/readline/readline-4.3/mbutil.c @@ -25,6 +25,8 @@ # include #endif +#define _XOPEN_SOURCE /* See feature_test_macros(7) */ + #include #include #include diff --git a/resis/ResBasic.c b/resis/ResBasic.c index 020a9ace..98c8d282 100644 --- a/resis/ResBasic.c +++ b/resis/ResBasic.c @@ -353,7 +353,7 @@ ResEachTile(tile, startpoint) { for (i = 0; i < devptr->exts_deviceSDCount; i++) { - if(TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1)) + if (TTMaskHasType(&(devptr->exts_deviceSDTypes[i]), t1)) { /* found device */ yj = TOP(tile); diff --git a/resis/ResDebug.c b/resis/ResDebug.c index 2eb210cc..be4775a9 100644 --- a/resis/ResDebug.c +++ b/resis/ResDebug.c @@ -80,14 +80,14 @@ ResPrintResistorList(fp, list) for (; list != NULL; list = list->rr_nextResistor) { if (fp == stdout) - TxPrintf("r (%d,%d) (%d,%d) r=%d\n", + TxPrintf("r (%d,%d) (%d,%d) r=%.2f\n", list->rr_connection1->rn_loc.p_x, list->rr_connection1->rn_loc.p_y, list->rr_connection2->rn_loc.p_x, list->rr_connection2->rn_loc.p_y, list->rr_value); else - fprintf(fp, "r (%d,%d) (%d,%d) r=%d\n", + fprintf(fp, "r (%d,%d) (%d,%d) r=%.2f\n", list->rr_connection1->rn_loc.p_x, list->rr_connection1->rn_loc.p_y, list->rr_connection2->rn_loc.p_x, diff --git a/resis/ResMakeRes.c b/resis/ResMakeRes.c index 4feeeb07..5a5ff1ad 100644 --- a/resis/ResMakeRes.c +++ b/resis/ResMakeRes.c @@ -667,11 +667,11 @@ ResCalcNearDevice(tile, pendingList, doneList, resList) /* 2. There are devices along two sides at right angles, */ /* and the tile is wider than it is tall. */ - if ((devedge & TOPEDGE) && (devedge & BOTTOMEDGE) && - !(devedge & LEFTEDGE) && !(devedge & RIGHTEDGE) || - (devedge & TOPEDGE || devedge & BOTTOMEDGE) && + if (((devedge & TOPEDGE) && (devedge & BOTTOMEDGE) && + !(devedge & LEFTEDGE) && !(devedge & RIGHTEDGE)) || + ((devedge & TOPEDGE || devedge & BOTTOMEDGE) && (devedge & LEFTEDGE || devedge & RIGHTEDGE) && - (RIGHT(tile) - LEFT(tile)) > (TOP(tile) - BOTTOM(tile))) + (RIGHT(tile) - LEFT(tile)) > (TOP(tile) - BOTTOM(tile)))) { /* re-sort nodes south to north. */ ResSortBreaks(&junk->breakList, FALSE); @@ -939,8 +939,8 @@ ResSortBreaks(masterlist, xsort) p3 = p2->br_next; while (p3 != NULL) { - if (xsort == TRUE && p2->br_loc.p_x > p3->br_loc.p_x || - xsort == FALSE && p2->br_loc.p_y > p3->br_loc.p_y) + if ((xsort == TRUE && p2->br_loc.p_x > p3->br_loc.p_x) || + (xsort == FALSE && p2->br_loc.p_y > p3->br_loc.p_y)) { changed = TRUE; if (p1 == NULL) diff --git a/resis/ResMerge.c b/resis/ResMerge.c index ff865492..57c35116 100644 --- a/resis/ResMerge.c +++ b/resis/ResMerge.c @@ -679,7 +679,8 @@ ResMergeNodes(node1, node2, pendingList, doneList) else { TxError("Bad plug node: is (%d %d), should be (%d %d)\n", - plug->rpl_node->rn_loc, node2->rn_loc); + plug->rpl_node->rn_loc.p_x, plug->rpl_node->rn_loc.p_y, + node2->rn_loc.p_x, node2->rn_loc.p_y); plug->rpl_node = NULL; } } diff --git a/resis/ResPrint.c b/resis/ResPrint.c index 17b20db9..50397eca 100644 --- a/resis/ResPrint.c +++ b/resis/ResPrint.c @@ -140,7 +140,7 @@ ResPrintExtDev(outextfile, devices) fprintf(outextfile,"device "); fprintf(outextfile,"%s %s %d %d %d %d ", - extDevTable[devptr->exts_deviceClass], + extDevTable[(unsigned char)devptr->exts_deviceClass], devptr->exts_deviceName, devices->layout->rd_inside.r_ll.p_x, devices->layout->rd_inside.r_ll.p_y, @@ -218,7 +218,7 @@ ResPrintExtNode(outextfile, nodelist, nodename) char *nodename; { int nodenum = 0; - char newname[MAXNAME], tmpname[MAXNAME], *cp; + char newname[MAXNAME+32], tmpname[MAXNAME], *cp; HashEntry *entry; ResSimNode *node, *ResInitializeNode(); bool DoKillNode = TRUE; diff --git a/resis/ResReadSim.c b/resis/ResReadSim.c index 1a6a0026..0671fdda 100644 --- a/resis/ResReadSim.c +++ b/resis/ResReadSim.c @@ -178,9 +178,11 @@ ResReadSim(simfile, fetproc, capproc, resproc, attrproc, mergeproc, subproc) break; case 'A': if (attrproc) + { result = (*attrproc)(line[ATTRIBUTENODENAME], line[ATTRIBUTEVALUE], simfile, &extfile); - break; + } + break; case 'x': fettype = DBNumTypes; break; @@ -265,7 +267,7 @@ ResReadNode(nodefile) node->rs_bbox.r_xtop = atoi(line[NODE_BBOX_UR_X]); node->rs_bbox.r_ytop = atoi(line[NODE_BBOX_UR_Y]); #endif - if (cp = strchr(line[NODES_NODETYPE], ';')) *cp = '\0'; + if ((cp = strchr(line[NODES_NODETYPE], ';'))) *cp = '\0'; node->type = DBTechNameType(line[NODES_NODETYPE]); if (node->type == -1) @@ -866,7 +868,7 @@ ResSimAttribute(aname, avalue, rootname, readextfile) } } #endif - if (avalue = strchr(avalue, ',')) + if ((avalue = strchr(avalue, ','))) { ResSimAttribute(aname, avalue + 1, rootname, readextfile); } diff --git a/resis/ResRex.c b/resis/ResRex.c index 31cfd8e5..83d2f920 100644 --- a/resis/ResRex.c +++ b/resis/ResRex.c @@ -6,6 +6,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include #include #include @@ -945,8 +946,8 @@ ResCheckPorts(cellDef) /* and a drivepoint. */ node = ResInitializeNode(entry); - TxPrintf("Port: name = %s is new node 0x%x\n", - lab->lab_text, node); + TxPrintf("Port: name = %s is new node %p\n", + lab->lab_text, (void *)node); TxPrintf("Location is (%d, %d); drivepoint (%d, %d)\n", portloc.p_x, portloc.p_y, portloc.p_x, portloc.p_y); @@ -1033,9 +1034,9 @@ ResCheckSimNodes(celldef, resisdata) ResFHFile = NULL; } - if (ResExtFile == NULL && (ResOptionsFlags & ResOpt_DoExtFile) - || (ResOptionsFlags & ResOpt_DoLumpFile) && ResLumpFile == NULL - || (ResOptionsFlags & ResOpt_FastHenry) && ResFHFile == NULL) + if ((ResExtFile == NULL && (ResOptionsFlags & ResOpt_DoExtFile)) + || ((ResOptionsFlags & ResOpt_DoLumpFile) && ResLumpFile == NULL) + || ((ResOptionsFlags & ResOpt_FastHenry) && ResFHFile == NULL)) { TxError("Couldn't open output file\n"); return; @@ -1837,7 +1838,7 @@ ResWriteExtFile(celldef, node, rctol, nidx, eidx) } for (ptr = node->firstDev; ptr != NULL; ptr=ptr->nextDev) { - if (layoutDev = ResGetDevice(&ptr->thisDev->location, ptr->thisDev->rs_ttype)) + if ((layoutDev = ResGetDevice(&ptr->thisDev->location, ptr->thisDev->rs_ttype))) { ResFixUpConnections(ptr->thisDev, layoutDev, node, newname); } diff --git a/resis/ResSimple.c b/resis/ResSimple.c index 13fbfd4c..3e87d673 100644 --- a/resis/ResSimple.c +++ b/resis/ResSimple.c @@ -198,8 +198,8 @@ ResSimplifyNet(nodelist, biglist, reslist, tolerance) * Break loop here. More than one driver indicates a loop; * remove deadend, allowing drivers to be merged */ - else if (UnMarkedReceivers == 0 && (MarkedReceivers == 1 && - NumberOfDrivers > 1 || resistor2 != resistor1)) + else if (UnMarkedReceivers == 0 && ((MarkedReceivers == 1 && + NumberOfDrivers > 1) || resistor2 != resistor1)) { otherNode->rn_float.rn_area += resistor1->rr_float.rr_area; @@ -1036,7 +1036,7 @@ ResSetPathRes() } if (ResOriginNode == NULL) { - resDevice *res = ResGetDevice(gparams.rg_devloc); + resDevice *res = ResGetDevice(gparams.rg_devloc, gparams.rg_ttype); ResOriginNode = res->rd_fet_source; ResOriginNode->rn_why = RES_NODE_ORIGIN; ResOriginNode->rn_noderes = 0; diff --git a/router/rtrCmd.c b/router/rtrCmd.c index 55e94271..590245d9 100644 --- a/router/rtrCmd.c +++ b/router/rtrCmd.c @@ -272,18 +272,18 @@ CmdGaRoute(w, cmd) char *cmd_name; cmdType cmd_val; } cmds[] = { - "channel xl yl xh yh [type]\n\ -channel [type] define a channel", CHANNEL, - "generate type [file] generate channel definition commands", - GEN, - "help print this message", HELP, - "nowarn only warn if all locations of a terminal\n\ - are unreachable", NOWARN, - "route [netlist] route the current cell",ROUTE, - "reset clear all channel definitions", RESET, - "warn leave feedback for each location of a\n\ - terminal that is unreachable", WARN, - 0 + {"channel xl yl xh yh [type]\n\ +channel [type] define a channel", CHANNEL}, + {"generate type [file] generate channel definition commands", + GEN}, + {"help print this message", HELP}, + {"nowarn only warn if all locations of a terminal\n\ + are unreachable", NOWARN}, + {"route [netlist] route the current cell",ROUTE}, + {"reset clear all channel definitions", RESET}, + {"warn leave feedback for each location of a\n\ + terminal that is unreachable", WARN}, + {0} }; GAInit(); @@ -640,7 +640,7 @@ CmdRoute(w, cmd) { if(cmd->tx_argc!=3) goto wrongNumArgs; - if(!sscanf(cmd->tx_argv[2], "%d", &RtrViaLimit)) + if(sscanf(cmd->tx_argv[2], "%d", &RtrViaLimit) != 1) TxError("Bad value for via limit\n"); } TxPrintf("Via limit is %d\n", RtrViaLimit); @@ -650,7 +650,7 @@ CmdRoute(w, cmd) { if(cmd->tx_argc!=3) goto wrongNumArgs; - if(!sscanf(cmd->tx_argv[2], "%f", &RtrEndConst)) + if(sscanf(cmd->tx_argv[2], "%f", &RtrEndConst) != 1) TxError("Bad value for channel end distance\n"); } TxPrintf("Channel end constant is %f\n", RtrEndConst); @@ -660,7 +660,7 @@ CmdRoute(w, cmd) { if(cmd->tx_argc!=3) goto wrongNumArgs; - if(!sscanf(cmd->tx_argv[2], "%d", &GCRMinJog)) + if(sscanf(cmd->tx_argv[2], "%d", &GCRMinJog) != 1) TxError("Bad value for minimum jog length\n"); } TxPrintf("Minimum jog length is %d\n", GCRMinJog); @@ -670,7 +670,7 @@ CmdRoute(w, cmd) { if(cmd->tx_argc!=3) goto wrongNumArgs; - if(!sscanf(cmd->tx_argv[2], "%f", &GCRObstDist)) + if(sscanf(cmd->tx_argv[2], "%f", &GCRObstDist) != 1) TxError("Bad value for obstacle constant\n"); } TxPrintf("Obstacle constant is %f\n", GCRObstDist); @@ -680,7 +680,7 @@ CmdRoute(w, cmd) { if(cmd->tx_argc!=3) goto wrongNumArgs; - if(!sscanf(cmd->tx_argv[2], "%d", &GCRSteadyNet)) + if(sscanf(cmd->tx_argv[2], "%d", &GCRSteadyNet) != 1) TxError("Bad value for steady net constant\n"); } TxPrintf("Steady net constant is %d\n", GCRSteadyNet); diff --git a/router/rtrDcmpose.c b/router/rtrDcmpose.c index b0f4e283..1161a672 100644 --- a/router/rtrDcmpose.c +++ b/router/rtrDcmpose.c @@ -432,7 +432,7 @@ rtrHashKill(ht) HashSearch hs; HashStartSearch(&hs); - while (he = HashNext(ht, &hs)) + while ((he = HashNext(ht, &hs))) GCRFreeChannel((GCRChannel *) HashGetValue(he)); HashKill(ht); } diff --git a/router/rtrPin.c b/router/rtrPin.c index 9f71d0dd..3fa77eb8 100644 --- a/router/rtrPin.c +++ b/router/rtrPin.c @@ -171,7 +171,7 @@ rtrPinArrayInit(ch, side, pins, nPins) if (side == GEO_WEST) p.p_x--; if (side == GEO_SOUTH) p.p_y--; tp = TiSrPointNoHint(RtrChannelPlane, &p); - if (adjacent = (GCRChannel *) tp->ti_client) + if ((adjacent = (GCRChannel *) tp->ti_client)) { /* Only link if entering the linked channel from a legal side */ linked = RtrPointToPin(adjacent, otherSide, &point); diff --git a/router/rtrStem.c b/router/rtrStem.c index 54b9da1a..90d6fe35 100644 --- a/router/rtrStem.c +++ b/router/rtrStem.c @@ -66,7 +66,7 @@ static struct dirs /* List of directions for stems */ { int dr_dir; /* Direction */ } - dirs[] = { GEO_NORTH, GEO_SOUTH, GEO_EAST, GEO_WEST, 0 }; + dirs[] = { {GEO_NORTH}, {GEO_SOUTH}, {GEO_EAST}, {GEO_WEST}, {0} }; #define MAKEBOX(p, r, width, offset) { \ (r)->r_xbot = (p)->p_x + (offset); \ @@ -355,7 +355,7 @@ RtrStemAssignExt(use, doWarn, loc, term, net) */ pins = 0; - loc->nloc_chan == (GCRChannel *) NULL; + loc->nloc_chan = (GCRChannel *) NULL; for ( dr = dirs; dr->dr_dir; dr++) { StemInfo si; @@ -370,7 +370,7 @@ RtrStemAssignExt(use, doWarn, loc, term, net) rtrStemRange(loc, dr->dr_dir, &si); if (si.stem_dir != -1) { - if (pin = rtrStemTip(loc, &si, use)) + if ((pin = rtrStemTip(loc, &si, use))) { /* Mark the pin as taken */ pins++; @@ -476,7 +476,7 @@ rtrStemTip(loc, si, use) * Try each crossing point in the best direction, starting from the * stem_start point and working outward toward stem_lo and stem_hi. */ - if (pin = rtrStemTryPin(loc, si->stem_dir, &si->stem_start, use)) + if ((pin = rtrStemTryPin(loc, si->stem_dir, &si->stem_start, use))) return (pin); plo = phi = si->stem_start; @@ -949,7 +949,7 @@ rtrStemSearch(center, dir, point) tile = TiSrPointNoHint(RtrChannelPlane, point); if (TiGetType(tile) == TT_SPACE) { - if (ch = (GCRChannel *) tile->ti_client) + if ((ch = (GCRChannel *) tile->ti_client)) break; return ((GCRChannel *) NULL); } diff --git a/select/selCreate.c b/select/selCreate.c index dff8707e..a8a3b903 100644 --- a/select/selCreate.c +++ b/select/selCreate.c @@ -1247,11 +1247,14 @@ SelectAndCopy2(newSourceDef) (void) DBCellCopyAllCells(&scx, CU_DESCEND_SPECIAL, EditCellUse, (Rect *) NULL); GeoTransRect(&scx.scx_trans, &scx.scx_area, &editArea); - DBAdjustLabels(EditCellUse->cu_def, &editArea); - DBWAreaChanged(EditCellUse->cu_def, &editArea, DBW_ALLWINDOWS, - (TileTypeBitMask *) NULL); - DRCCheckThis(EditCellUse->cu_def, TT_CHECKPAINT, &editArea); - DBReComputeBbox(EditCellUse->cu_def); + if (EditCellUse != NULL) + { + DBAdjustLabels(EditCellUse->cu_def, &editArea); + DBWAreaChanged(EditCellUse->cu_def, &editArea, DBW_ALLWINDOWS, + (TileTypeBitMask *) NULL); + DRCCheckThis(EditCellUse->cu_def, TT_CHECKPAINT, &editArea); + DBReComputeBbox(EditCellUse->cu_def); + } SelectRootDef = newSourceDef; SelSetDisplay(SelectUse, SelectRootDef); diff --git a/select/selEnum.c b/select/selEnum.c index b59b0964..8cb6e7ec 100644 --- a/select/selEnum.c +++ b/select/selEnum.c @@ -320,8 +320,8 @@ selEnumPFunc2(tile, arg) /* Also okay if the X over Y yields a stacking type whose residues */ /* are X and Y. */ - if ((ttype != seltype) && (((ttype == TT_SPACE) && - TTMaskHasType(&DBHomePlaneTypes[arg->sea_plane], seltype))) || + if (((ttype != seltype) && (((ttype == TT_SPACE) && + TTMaskHasType(&DBHomePlaneTypes[arg->sea_plane], seltype)))) || (DBPaintResultTbl[arg->sea_plane][ttype][seltype] != seltype)) { TileType chktype = DBPaintResultTbl[arg->sea_plane][ttype][seltype]; diff --git a/select/selOps.c b/select/selOps.c index 3305b48f..f620e15d 100644 --- a/select/selOps.c +++ b/select/selOps.c @@ -942,7 +942,7 @@ SelectShort(char *lab1, char *lab2) /* Make sure the selection is clear before starting */ SelectClear(); - ttype = CmdFindNetProc(lab1, use, &rect, FALSE); + ttype = CmdFindNetProc(lab1, use, &rect, FALSE, NULL); if (ttype == TT_SPACE) return NULL; bzero(&scx, sizeof(SearchContext)); @@ -997,7 +997,7 @@ SelectShort(char *lab1, char *lab2) } } - selShortFindForward(srctile, srctype, srcpnum, desttile, desttype); + selShortFindForward(srctile, srctype, srcpnum, desttile/*, desttype*/); /* Now see if destination has been counted */ if (desttile->ti_client == (ClientData)CLIENTDEFAULT) return NULL; @@ -1942,6 +1942,8 @@ selStretchFillFunc3(tile, area) else if (selStretchY < 0) type = (SplitDirection(tile) ? SplitLeftType(tile) : SplitRightType(tile)); + else + type = TT_SPACE; if (type == TT_SPACE) return 0; /* nothing to stretch */ } else diff --git a/select/selUndo.c b/select/selUndo.c index 813b5c84..9b6ade6e 100644 --- a/select/selUndo.c +++ b/select/selUndo.c @@ -193,7 +193,7 @@ SelRememberForUndo(before, def, area) { SelUndoEvent *sue; static SelUndoEvent *beforeEvent = NULL; - static Rect nullRect = {0, 0, -1, -1}; + static Rect nullRect = {{0, 0}, {-1, -1}}; sue = (SelUndoEvent *) UndoNewEvent(SelUndoClientID, sizeof(SelUndoEvent)); if (sue == NULL) return; diff --git a/sim/SimExtract.c b/sim/SimExtract.c index 417c9879..eb7f0981 100644 --- a/sim/SimExtract.c +++ b/sim/SimExtract.c @@ -486,7 +486,7 @@ SimTransistorTile(tile, pNum, arg) devptr = ExtCurStyle->exts_device[t]; for (i = 0; !TTMaskHasType(&devptr->exts_deviceSDTypes[i], TT_SPACE); i++) - extEnumTilePerim(tile, devptr->exts_deviceSDTypes[i], + extEnumTilePerim(tile, devptr->exts_deviceSDTypes[i], pNum, SimTransTerms, (ClientData) &transistor ); } diff --git a/sim/SimRsim.c b/sim/SimRsim.c index 129a73f6..5088e8c3 100644 --- a/sim/SimRsim.c +++ b/sim/SimRsim.c @@ -553,7 +553,7 @@ SimRsimIt(cmd, nodeName) char *nodeName; { - static char cmdStr[256]; + static char cmdStr[512]; static char cleanName[256]; char *strptr; diff --git a/sim/SimSelect.c b/sim/SimSelect.c index db0ffebd..41290dea 100644 --- a/sim/SimSelect.c +++ b/sim/SimSelect.c @@ -445,7 +445,7 @@ SimSelection(cmd) char *strPtr; bool goodReply; - extern RsimErrorMsg(); + extern void RsimErrorMsg(); timeString[0] = 0; diff --git a/tcltk/tclmagic.c b/tcltk/tclmagic.c index 9c92bf55..4408fc16 100644 --- a/tcltk/tclmagic.c +++ b/tcltk/tclmagic.c @@ -445,6 +445,8 @@ _tk_dispatch(ClientData clientData, char *arg0; Point txp; + arg0 = argv[0]; + if (GrWindowIdPtr) { /* Key macros set the point from the graphics module code but */ @@ -466,7 +468,6 @@ _tk_dispatch(ClientData clientData, txp.p_y = 20; } TxSetPoint(txp.p_x, txp.p_y, id); - arg0 = argv[0]; argc--; argv++; } diff --git a/tcltk/toolbar.tcl b/tcltk/toolbar.tcl index a587dac3..d8f68e22 100644 --- a/tcltk/toolbar.tcl +++ b/tcltk/toolbar.tcl @@ -121,26 +121,46 @@ proc createLayerFrame {framename layername i} { # Place the layer button, checking if it is locked or not set locklist [tech locked] - # Locked button bindings if {[lsearch $locklist $layername] != -1} { + # Locked button bindings + set toolbar_button ${layer_frame}.p + button $toolbar_button -image pale_$layername + + # Bind keypresses when mouse if over layer frame + bind $layer_frame \ + "$win tech unlock $layername ; \ + grid forget $toolbar_button ; \ + grid ${layer_frame}.b -row $i -column 0 -sticky w" + + # Bindings for painiting, erasing and seeing layers, + # which are bound both to the layer button, as well + # as the layer label + set childrenList [winfo children $layer_frame] + + foreach child $childrenList { + # 3rd mouse button makes layer invisible; 1st mouse button restores it. + # 2nd mouse button paints the layer color. Key "p" also does paint, esp. + # for users with 2-button mice. Key "e" erases, as does Shift-Button-2. + bind $child "$win see $layername" + bind $child "$win see no $layername" + + # Intercept mousewheel on the layer/button as well + bind $child \ + [subst { event generate ${framename}.toolbar.canvas }] + bind $child \ + [subst { event generate ${framename}.toolbar.canvas }] + } + + # Bind the mouse enter event to highlight the label + bind $toolbar_label "$toolbar_label configure -background yellow" - button $toolbar_button -image pale_$layername -command \ - "$win see $layername" bind $layer_frame \ - [subst {focus %W ; ${framename}.titlebar.message configure \ - -text "$layername (locked)"}] + [subst {focus %W ; ${framename}.titlebar.message configure \ + -text "$layername (locked)"}] - bind $layer_frame \ - "$win see no $layername" - - bind $layer_frame \ - "$win tech unlock $layername ; \ - grid forget $toolbar_button ; \ - grid ${layer_frame}.b -row $i -column 0 -sticky w" - - # Unlocked button bindings } else { + # Unlocked button bindings set toolbar_button ${layer_frame}.b button $toolbar_button -image img_$layername @@ -162,21 +182,21 @@ proc createLayerFrame {framename layername i} { # as the layer label set childrenList [winfo children $layer_frame] - foreach child $childrenList { - # 3rd mouse button makes layer invisible; 1st mouse button restores it. - # 2nd mouse button paints the layer color. Key "p" also does paint, esp. - # for users with 2-button mice. Key "e" erases, as does Shift-Button-2. - bind $child "$win see $layername" - bind $child "$win paint $layername" - bind $child "$win erase $layername" - bind $child "$win see no $layername" + foreach child $childrenList { + # 3rd mouse button makes layer invisible; 1st mouse button restores it. + # 2nd mouse button paints the layer color. Key "p" also does paint, esp. + # for users with 2-button mice. Key "e" erases, as does Shift-Button-2. + bind $child "$win see $layername" + bind $child "$win paint $layername" + bind $child "$win erase $layername" + bind $child "$win see no $layername" - # Intercept mousewheel on the layer/button as well - bind $child \ - [subst { event generate ${framename}.toolbar.canvas }] - bind $child \ - [subst { event generate ${framename}.toolbar.canvas }] - } + # Intercept mousewheel on the layer/button as well + bind $child \ + [subst { event generate ${framename}.toolbar.canvas }] + bind $child \ + [subst { event generate ${framename}.toolbar.canvas }] + } # Bind the mouse enter event to highlight the label bind $toolbar_label "$toolbar_label configure -background yellow" diff --git a/tcltk/wrapper.tcl b/tcltk/wrapper.tcl index 6f3c68b7..db13bbe2 100644 --- a/tcltk/wrapper.tcl +++ b/tcltk/wrapper.tcl @@ -243,12 +243,12 @@ proc magic::drcupdate { option } { } proc magic::drcstate { status } { - logcommands suspend + *bypass logcommands suspend set winlist [*bypass windownames layout] foreach lwin $winlist { set framename [winfo parent $lwin] if {$framename == "."} { - logcommands resume + *bypass logcommands resume return } switch $status { @@ -264,7 +264,7 @@ proc magic::drcstate { status } { busy { ${framename}.titlebar.drcbutton configure -selectcolor yellow } } } - logcommands resume + *bypass logcommands resume } # Create the menu of windows. This is kept separate from the cell manager, @@ -515,7 +515,7 @@ proc magic::captions {{subcommand {}}} { if {$subcommand != {} && $subcommand != "writeable" && $subcommand != "load"} { return } - logcommands suspend + *bypass logcommands suspend set winlist [magic::windownames layout] foreach winpath $winlist { set framename [winfo parent $winpath] @@ -535,7 +535,7 @@ proc magic::captions {{subcommand {}}} { "Loaded: ${subcaption1} Editing: ${subcaption2} Tool: $Opts(tool) \ Technology: ${techname}" } - logcommands resume + *bypass logcommands resume } # Allow captioning in the title window by tagging the "load" and "edit" commands @@ -670,10 +670,10 @@ proc magic::cursorview {win} { if {$win == {}} { return } - logcommands suspend + *bypass logcommands suspend set framename [winfo parent $win] if {[catch {set cr [*bypass cif scale out]}]} { - logcommands resume + *bypass logcommands resume return } if {$cr == 0} {return} @@ -691,7 +691,7 @@ proc magic::cursorview {win} { set olstx [expr {$olstx * $cr}] set olsty [expr {$olsty * $cr}] }]} { - logcommands resume + *bypass logcommands resume return } @@ -707,24 +707,24 @@ proc magic::cursorview {win} { set titletext [format "(%+g %+g) microns" $olstx $olsty] ${framename}.titlebar.pos configure -text $titletext } - logcommands resume + *bypass logcommands resume } proc magic::toolupdate {win {yesno "yes"} {layerlist "none"}} { global Winopts if {[magic::display] == "NULL"} {return} - logcommands suspend + *bypass logcommands suspend if {$win == {}} { set win [magic::windownames] } # Wind3d has a "see" function, so make sure this is not a 3d window if {$win == [magic::windownames wind3d]} { - logcommands resume + *bypass logcommands resume return } - logcommands resume + *bypass logcommands resume set topname [winfo toplevel $win] set framename [winfo parent $win] @@ -760,12 +760,16 @@ proc magic::toolupdate {win {yesno "yes"} {layerlist "none"}} { # "hidespecial" is used, so catch each configure command. if {$canon != ""} { - if {$yesno == "yes"} { - catch {${framename}.toolbar.b$canon configure -image img_$canon} - catch {${framename}.toolbar.p$canon configure -image pale_$canon} - } else { - catch {${framename}.toolbar.b$canon configure -image img_space} - catch {${framename}.toolbar.p$canon configure -image img_space} + # Layer aliases like "allm1" expand into multiple layers + foreach clayer $canon { + set toolframe ${framename}.toolbar.canvas.frame.f${clayer} + if {$yesno == "yes"} { + catch {${toolframe}.b configure -image img_$clayer} + catch {${toolframe}.p configure -image pale_$clayer} + } else { + catch {${toolframe}.b configure -image img_space} + catch {${toolframe}.p configure -image img_space} + } } } } @@ -827,13 +831,13 @@ proc magic::techrebuild {winpath {cmdstr ""}} { proc magic::setscrollvalues {win} { global Opts - logcommands suspend + *bypass logcommands suspend set svalues [${win} view get] set bvalues [${win} view bbox] set framename [winfo parent ${win}] if {$framename == "."} { - logcommands resume + *bypass logcommands resume return } @@ -877,7 +881,7 @@ proc magic::setscrollvalues {win} { proc magic::scrollupdate {win} { - logcommands suspend + *bypass logcommands suspend if {[magic::display] == "NULL"} {return} if {[info level] <= 1} { @@ -894,7 +898,7 @@ proc magic::scrollupdate {win} { magic::setscrollvalues $win } } - logcommands resume + *bypass logcommands resume } # scrollview: update the magic display to match the diff --git a/textio/txCommands.c b/textio/txCommands.c index 554cae2c..dbf82652 100644 --- a/textio/txCommands.c +++ b/textio/txCommands.c @@ -201,7 +201,7 @@ void TxPrintEvent(event) TxInputEvent *event; { - TxError("Input event at 0x%x\n ", event); + TxError("Input event at %p\n ", event); if (event->txe_button == TX_EOF) { TxError("EOF event"); } else if (event->txe_button == TX_BYPASS) { @@ -255,7 +255,7 @@ TxPrintCommand(cmd) int i, j; char TxTemp[200]; - TxError("Command at 0x%x\n ", cmd); + TxError("Command at %p\n ", cmd); if (cmd->tx_button == TX_CHARACTER) { TxError("Text command with %d words: ", cmd->tx_argc); for (i = 0; i < cmd->tx_argc; i++) { @@ -639,7 +639,7 @@ TxLogStart(fileName, mw) { if (txLogFile != NULL) { - TxError("There is already a log file (%s) open!\n", txLogFile); + TxError("There is already a log file open!\n"); return; } @@ -880,15 +880,16 @@ txLogCommand(cmd) case TX_LEFT_BUTTON: { but = 0; break; }; case TX_MIDDLE_BUTTON: { but = 1; break; }; case TX_RIGHT_BUTTON: { but = 2; break; }; - default: {ASSERT(FALSE, "txLogCommand"); break; }; + default: {ASSERT(FALSE, "txLogCommand"); but = -1; break; }; } switch(cmd->tx_buttonAction) { case TX_BUTTON_DOWN: { act = 0; break; }; case TX_BUTTON_UP: { act = 1; break; }; - default: {ASSERT(FALSE, "txLogCommand"); break; }; + default: {ASSERT(FALSE, "txLogCommand"); act = -1; break; }; } - fprintf(txLogFile, "%spushbutton %s %s\n", + if (but >= 0 && act >= 0) + fprintf(txLogFile, "%spushbutton %s %s\n", pfix, txButTable[but], txActTable[act]); } if (txLogFlags & TX_LOG_UPDATE) diff --git a/textio/txInput.c b/textio/txInput.c index e8756c5c..7a22eafb 100644 --- a/textio/txInput.c +++ b/textio/txInput.c @@ -547,6 +547,7 @@ TxPrefix(void) if (_rl_prefix != NULL) rl_insert_text(_rl_prefix); rl_redisplay(); + return 0; } /* diff --git a/textio/txOutput.c b/textio/txOutput.c index 7d6bda23..7aec132e 100644 --- a/textio/txOutput.c +++ b/textio/txOutput.c @@ -405,7 +405,7 @@ TxUseMore() pagername++; else pagername = pagerpath; - execl(pagerpath, pagername, 0); + execl(pagerpath, pagername, NULL); /* Something went very wrong if it gets here. */ diff --git a/tiles/tile.c b/tiles/tile.c index 9eaecec1..a1faa840 100644 --- a/tiles/tile.c +++ b/tiles/tile.c @@ -57,7 +57,7 @@ TiSetBody(tp, b) * this area. */ -global Rect TiPlaneRect = { MINFINITY+2, MINFINITY+2, INFINITY-2, INFINITY-2 }; +global Rect TiPlaneRect = { {MINFINITY+2, MINFINITY+2}, {INFINITY-2, INFINITY-2} }; #ifdef HAVE_SYS_MMAN_H diff --git a/utils/geofast.h b/utils/geofast.h index 1af24db1..af1f3664 100644 --- a/utils/geofast.h +++ b/utils/geofast.h @@ -32,12 +32,12 @@ */ #define GEOCLIP(r, area) \ - if (1) { \ + do { \ if ((r)->r_xbot < (area)->r_xbot) (r)->r_xbot = (area)->r_xbot; \ if ((r)->r_ybot < (area)->r_ybot) (r)->r_ybot = (area)->r_ybot; \ if ((r)->r_xtop > (area)->r_xtop) (r)->r_xtop = (area)->r_xtop; \ if ((r)->r_ytop > (area)->r_ytop) (r)->r_ytop = (area)->r_ytop; \ - } else + } while(0) /* --------------------- Transforming rectangles ---------------------- */ diff --git a/utils/geometry.c b/utils/geometry.c index 791f390b..8f17a433 100644 --- a/utils/geometry.c +++ b/utils/geometry.c @@ -74,8 +74,8 @@ global int GeoOppositePos[] = *------------------------------------------------------------------- */ -global Rect GeoNullRect = { 0, 0, 0, 0 }; -global Rect GeoInvertedRect = { 0, 0, -1, -1 }; +global Rect GeoNullRect = { {0, 0}, {0, 0} }; +global Rect GeoInvertedRect = { {0, 0}, {-1, -1} }; global Point GeoOrigin = { 0, 0 }; @@ -365,40 +365,40 @@ GeoNameToPos(name, manhattan, verbose) } positions[] = { - "bl", GEO_SOUTHWEST, FALSE, - "bottom", GEO_SOUTH, TRUE, - "br", GEO_SOUTHEAST, FALSE, - "center", GEO_CENTER, FALSE, - "d", GEO_SOUTH, TRUE, - "dl", GEO_SOUTHWEST, FALSE, - "down", GEO_SOUTH, TRUE, - "dr", GEO_SOUTHEAST, FALSE, - "e", GEO_EAST, TRUE, - "east", GEO_EAST, TRUE, - "left", GEO_WEST, TRUE, - "n", GEO_NORTH, TRUE, - "ne", GEO_NORTHEAST, FALSE, - "north", GEO_NORTH, TRUE, - "northeast", GEO_NORTHEAST, FALSE, - "northwest", GEO_NORTHWEST, FALSE, - "nw", GEO_NORTHWEST, FALSE, - "right", GEO_EAST, TRUE, - "s", GEO_SOUTH, TRUE, - "se", GEO_SOUTHEAST, FALSE, - "south", GEO_SOUTH, TRUE, - "southeast", GEO_SOUTHEAST, FALSE, - "southwest", GEO_SOUTHWEST, FALSE, - "sw", GEO_SOUTHWEST, FALSE, - "tl", GEO_NORTHWEST, FALSE, - "top", GEO_NORTH, TRUE, - "tr", GEO_NORTHEAST, FALSE, - "u", GEO_NORTH, TRUE, - "ul", GEO_NORTHWEST, FALSE, - "up", GEO_NORTH, TRUE, - "ur", GEO_NORTHEAST, FALSE, - "w", GEO_WEST, TRUE, - "west", GEO_WEST, TRUE, - 0 + {"bl", GEO_SOUTHWEST, FALSE}, + {"bottom", GEO_SOUTH, TRUE}, + {"br", GEO_SOUTHEAST, FALSE}, + {"center", GEO_CENTER, FALSE}, + {"d", GEO_SOUTH, TRUE}, + {"dl", GEO_SOUTHWEST, FALSE}, + {"down", GEO_SOUTH, TRUE}, + {"dr", GEO_SOUTHEAST, FALSE}, + {"e", GEO_EAST, TRUE}, + {"east", GEO_EAST, TRUE}, + {"left", GEO_WEST, TRUE}, + {"n", GEO_NORTH, TRUE}, + {"ne", GEO_NORTHEAST, FALSE}, + {"north", GEO_NORTH, TRUE}, + {"northeast", GEO_NORTHEAST, FALSE}, + {"northwest", GEO_NORTHWEST, FALSE}, + {"nw", GEO_NORTHWEST, FALSE}, + {"right", GEO_EAST, TRUE}, + {"s", GEO_SOUTH, TRUE}, + {"se", GEO_SOUTHEAST, FALSE}, + {"south", GEO_SOUTH, TRUE}, + {"southeast", GEO_SOUTHEAST, FALSE}, + {"southwest", GEO_SOUTHWEST, FALSE}, + {"sw", GEO_SOUTHWEST, FALSE}, + {"tl", GEO_NORTHWEST, FALSE}, + {"top", GEO_NORTH, TRUE}, + {"tr", GEO_NORTHEAST, FALSE}, + {"u", GEO_NORTH, TRUE}, + {"ul", GEO_NORTHWEST, FALSE}, + {"up", GEO_NORTH, TRUE}, + {"ur", GEO_NORTHEAST, FALSE}, + {"w", GEO_WEST, TRUE}, + {"west", GEO_WEST, TRUE}, + {0} }; struct pos *pp; char *fmt; @@ -586,6 +586,8 @@ GeoTransOrient(t) return ORIENT_FLIPPED_WEST; } } + + return ORIENT_NORTH; } diff --git a/utils/getrect.c b/utils/getrect.c index f5a572a0..e7c73134 100644 --- a/utils/getrect.c +++ b/utils/getrect.c @@ -69,28 +69,28 @@ GetRect(fin, skip, rect, scalen, scaled) while (skip-- > 0) (void) FGETC(fin); - if (isNegative = ((c = FGETC(fin)) == '-')) c = FGETC(fin); + if ((isNegative = ((c = FGETC(fin)) == '-'))) c = FGETC(fin); for (n = 0; isdigit(c); n = n * 10 + c - '0', c = FGETC(fin)) /* Nothing */; rect->r_xbot = isNegative ? -n : n; if (!isspace(c)) goto bad; while ((c = FGETC(fin)) != EOF && isspace(c)) /* Nothing */; - if (isNegative = (c == '-')) c = FGETC(fin); + if ((isNegative = (c == '-'))) c = FGETC(fin); for (n = 0; isdigit(c); n = n * 10 + c - '0', c = FGETC(fin)) /* Nothing */; rect->r_ybot = isNegative ? -n : n; if (!isspace(c)) goto bad; while ((c = FGETC(fin)) != EOF && isspace(c)) /* Nothing */; - if (isNegative = (c == '-')) c = FGETC(fin); + if ((isNegative = (c == '-'))) c = FGETC(fin); for (n = 0; isdigit(c); n = n * 10 + c - '0', c = FGETC(fin)) /* Nothing */; rect->r_xtop = isNegative ? -n : n; if (!isspace(c)) goto bad; while ((c = FGETC(fin)) != EOF && isspace(c)) /* Nothing */; - if (isNegative = (c == '-')) c = FGETC(fin); + if ((isNegative = (c == '-'))) c = FGETC(fin); for (n = 0; isdigit(c); n = n * 10 + c - '0', c = FGETC(fin)) /* Nothing */; rect->r_ytop = isNegative ? -n : n; diff --git a/utils/hash.c b/utils/hash.c index 93f62419..2460a48f 100644 --- a/utils/hash.c +++ b/utils/hash.c @@ -729,7 +729,7 @@ HashTable *table; void *p; HashStartSearch(&hs); - while (he = HashNext(table, &hs)) { + while ((he = HashNext(table, &hs))) { p = HashGetValue(he); freeMagic(p); } diff --git a/utils/heap.c b/utils/heap.c index 69b85c9d..09900d74 100644 --- a/utils/heap.c +++ b/utils/heap.c @@ -325,7 +325,7 @@ heapify(heap, root) while (1) { if ((x = heapLeft(used, root)) == 0) break; - if (r = heapRight(used, root)) + if ((r = heapRight(used, root))) KEY_LESS_COND(keyType, list, x, r, x = r); KEY_LE_COND(keyType, list, x, root, return); @@ -341,7 +341,7 @@ heapify(heap, root) while (1) { if ((x = heapLeft(used, root)) == 0) break; - if (r = heapRight(used, root)) + if ((r = heapRight(used, root))) KEY_GREATER_COND(keyType, list, x, r, x = r); KEY_GE_COND(keyType, list, x, root, return); *list = list[root]; diff --git a/utils/macros.c b/utils/macros.c index 8f683ac2..6195698c 100644 --- a/utils/macros.c +++ b/utils/macros.c @@ -22,6 +22,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include +#include #include #include #ifdef XLIB @@ -555,6 +556,8 @@ MacroKey(str, verbose) kc = (int)tc; else if (kmod & ControlMask) kc = (int)(tc - 'A' + 1); + else + kc = (int)tc; if (!(kmod & (Mod1Mask | LockMask))) if (!(kmod & ShiftMask) || !(kmod & ControlMask)) diff --git a/utils/magic.h b/utils/magic.h index d0b78e67..eebcd253 100644 --- a/utils/magic.h +++ b/utils/magic.h @@ -36,12 +36,12 @@ #define SIZEOF_VOID_P SIZEOF_UNSIGNED_INT #endif -#if SIZEOF_VOID_P == SIZEOF_UNSIGNED_INT -typedef unsigned int pointertype; -typedef signed int spointertype; -#elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG +#if SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG typedef unsigned long pointertype; typedef signed long spointertype; +#elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_INT +typedef unsigned int pointertype; +typedef signed int spointertype; #else ERROR: Cannot compile without knowing the size of a pointer. See utils/magic.h #endif @@ -49,7 +49,13 @@ ERROR: Cannot compile without knowing the size of a pointer. See utils/magic.h typedef int64_t dlong; #define DLONG_MAX INT64_MAX #define DLONG_MIN INT64_MIN +#if (defined(__x86_64__) && !defined(_WIN64)) +/* gcc x86_64 defines int64_t as 'long int' on LP64 */ +#define DLONG_PREFIX "l" +#else +/* for 32bit and 64bit LLP64 (_WIN64) systems */ #define DLONG_PREFIX "ll" +#endif /* --------------------- Universal pointer type ----------------------- */ diff --git a/utils/main.c b/utils/main.c index cc9b2304..f1aa9d84 100644 --- a/utils/main.c +++ b/utils/main.c @@ -25,6 +25,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include #include #include +#include #include #include @@ -1164,7 +1165,7 @@ mainInitFinal() if (mainRecover && MakeMainWindow) { - DBFileRecovery(); + DBFileRecovery(NULL); /* automatic search most recent */ } /* @@ -1188,10 +1189,10 @@ mainInitFinal() break; #ifdef LEF_MODULE case FN_LEF_FILE: - LefRead(temporary->fn, FALSE, FALSE); + LefRead(temporary->fn, FALSE, FALSE, -1); break; case FN_DEF_FILE: - DefRead(temporary->fn, FALSE); + DefRead(temporary->fn, FALSE, FALSE, FALSE); break; #endif #ifdef MAGIC_WRAPPER diff --git a/utils/netlist.c b/utils/netlist.c index 5256621c..af01e081 100644 --- a/utils/netlist.c +++ b/utils/netlist.c @@ -320,7 +320,7 @@ NLSort(netList, netHeap) /* Find bounding box around all terminals in this net */ nterms = 0; for (term = net->nnet_terms; term; term = term->nterm_next) - if (loc = term->nterm_locs) + if ((loc = term->nterm_locs)) { for ( ; loc; loc = loc->nloc_next) { @@ -369,6 +369,8 @@ NLNetName(net) static char tempId[100]; #if defined(EMSCRIPTEN) int etext; +#elif defined(linux) && defined(__clang__) + extern char etext; #elif defined(linux) || defined(CYGWIN) extern int etext asm("etext"); #elif defined(__APPLE__) diff --git a/utils/niceabort.c b/utils/niceabort.c index 8c23fb5b..19a38736 100644 --- a/utils/niceabort.c +++ b/utils/niceabort.c @@ -67,7 +67,7 @@ DumpCore() int cpid, gcpid, wpid; FILE *commentFile, *crashFile; time_t now; - char pidString[20], line[150], command[200], tempName[200], *crashDir; + char pidString[20], line[150], command[512], tempName[200], *crashDir; TxPrintf("Please wait while magic generates a core image of itself....\n"); sprintf(pidString, "%d", parentPid); @@ -118,7 +118,7 @@ DumpCore() * to place the crash dump. */ - if (crashFile = PaOpen(CRASHDIR, "r", "", ".", "", &crashDir)) + if ((crashFile = PaOpen(CRASHDIR, "r", "", ".", "", &crashDir))) { (void) fclose(crashFile); diff --git a/utils/path.c b/utils/path.c index 852b2ef2..3a0fea80 100644 --- a/utils/path.c +++ b/utils/path.c @@ -736,8 +736,9 @@ PaLockOpen(file, mode, ext, path, library, pRealName, is_locked, fdp) #endif f = fopen(realName, mode); - if ((fdp != NULL) && (f != NULL)) *fdp = fileno(f); - return f; + if ((fdp != NULL) && (f != NULL)) *fdp = fileno(f); + if ((f != NULL) || (file[0] == '/')) + return f; } /* Now try going through the path, one entry at a time. */ @@ -883,9 +884,15 @@ PaZOpen(file, mode, ext, path, library, pRealName) || strcmp(file, "..") == 0 || strncmp(file, "../", 3) == 0))) { + gzFile result; (void) strncpy(realName, file, MAXSIZE-1); realName[MAXSIZE-1] = '\0'; - return gzopen(realName, mode); + + /* For full paths, halt immediately if not found. Otherwise, + * treat the path as relative to something in the search path. + */ + result = gzopen(realName, mode); + if ((result != NULL) || (file[0] == '/')) return result; } /* Now try going through the path, one entry at a time. */ @@ -1092,7 +1099,7 @@ PaEnum(path, file, proc, cdata) { char component[MAXSIZE], *next; - while (next = nextName(&path, file, component, sizeof component)) + while ((next = nextName(&path, file, component, sizeof component))) if (next[0] && (*proc)(next, cdata)) return (1); diff --git a/utils/pathvisit.c b/utils/pathvisit.c index d9b87f78..606272e7 100644 --- a/utils/pathvisit.c +++ b/utils/pathvisit.c @@ -242,7 +242,7 @@ paVisitFilesProc(name, pv) } } *lp = '\0'; - if (code = paVisitProcess(lp = line, pv)) + if ((code = paVisitProcess(lp = line, pv))) break; next: ; } @@ -292,7 +292,7 @@ paVisitProcess(line, pv) for (pvc = pv->pv_first; pvc; pvc = pvc->pvc_next) if (len > 0 && strncmp(line, pvc->pvc_keyword, len) == 0) - if (code = (*pvc->pvc_proc)(line, pvc->pvc_cdata)) + if ((code = (*pvc->pvc_proc)(line, pvc->pvc_cdata))) break; return (code); diff --git a/utils/set.c b/utils/set.c index 22bbcad7..8c0637bd 100644 --- a/utils/set.c +++ b/utils/set.c @@ -101,7 +101,7 @@ SetNoisyBool(parm,valueS,file) char *valueS; FILE *file; { - int n, which, result; + int n, which, result = -2; /* Bool string Table */ static struct @@ -109,15 +109,15 @@ SetNoisyBool(parm,valueS,file) char *bS_name; /* name */ bool bS_value; /* procedure processing this parameter */ } boolStrings[] = { - "yes", TRUE, - "no", FALSE, - "true", TRUE, - "false", FALSE, - "1", TRUE, - "0", FALSE, - "on", TRUE, - "off", FALSE, - 0 + {"yes", TRUE}, + {"no", FALSE}, + {"true", TRUE}, + {"false", FALSE}, + {"1", TRUE}, + {"0", FALSE}, + {"on", TRUE}, + {"off", FALSE}, + {0} }; /* If value not null, set parm */ @@ -145,15 +145,19 @@ SetNoisyBool(parm,valueS,file) } else { - TxError("Unrecognized boolean value: \"%s\"\n", valueS); - TxError("Valid values are: "); - for (n = 0; boolStrings[n].bS_name; n++) - TxError(" %s", boolStrings[n].bS_name); - TxError("\n"); result = -2; } } + if (result == -2) + { + TxError("Unrecognized boolean value: \"%s\"\n", valueS); + TxError("Valid values are: "); + for (n = 0; boolStrings[n].bS_name; n++) + TxError(" %s", boolStrings[n].bS_name); + TxError("\n"); + } + /* Print parm value */ if(file) fprintf(file,"%8.8s ", *parm ? "YES" : "NO"); diff --git a/utils/tech.c b/utils/tech.c index f0d9bf06..20fbcbb6 100644 --- a/utils/tech.c +++ b/utils/tech.c @@ -651,7 +651,7 @@ TechLoad(filename, initmask) skip = TRUE; continue; } - if (mask = (tsp->ts_prevSects & ~techSectionMask)) + if ((mask = (tsp->ts_prevSects & ~techSectionMask))) { techSection *sp; diff --git a/utils/undo.c b/utils/undo.c index 06b85292..7baa50b5 100644 --- a/utils/undo.c +++ b/utils/undo.c @@ -910,8 +910,8 @@ undoPrintEvent(iup) else client_name = undoClientTable[iup->iue_type].uc_name; - (void) TxPrintf("0x%x: \t%s \tf=0x%x \tb=0x%x\n", - iup, client_name, iup->iue_forw, iup->iue_back); + (void) TxPrintf("%p: \t%s \tf=%p \tb=%p\n", + (void *)iup, client_name, (void *)iup->iue_forw, (void *)iup->iue_back); } /* Print events forward from "iup". If n is 0 or negative, print to */ @@ -924,8 +924,8 @@ undoPrintForw(iup, n) { int i = 0; - (void) TxPrintf("head=0x%x\ttail=0x%x\tcur=0x%x\n", - undoLogHead, undoLogTail, undoLogCur); + (void) TxPrintf("head=%p\ttail=%p\tcur=%p\n", + (void *)undoLogHead, (void *)undoLogTail, (void *)undoLogCur); if (iup == (internalUndoEvent *) NULL) iup = undoLogHead; while (iup != (internalUndoEvent *) NULL) @@ -947,8 +947,8 @@ undoPrintBack(iup, n) { int i = 0; - (void) TxPrintf("head=0x%x\ttail=0x%x\tcur=0x%x\n", - undoLogHead, undoLogTail, undoLogCur); + (void) TxPrintf("head=%p\ttail=%p\tcur=%p\n", + (void *)undoLogHead, (void *)undoLogTail, (void *)undoLogCur); if (iup == (internalUndoEvent *) NULL) iup = undoLogTail; while (iup != (internalUndoEvent *) NULL) diff --git a/windows/windCmdAM.c b/windows/windCmdAM.c index e2ce0639..81f5d4a8 100644 --- a/windows/windCmdAM.c +++ b/windows/windCmdAM.c @@ -1120,7 +1120,7 @@ windDoMacro(w, cmd, interactive) if (cmd->tx_argc == argstart) { - h = HashLookOnly(&MacroClients, wc); + h = HashLookOnly(&MacroClients, (char *)wc); if (h == NULL) return; else diff --git a/windows/windDebug.c b/windows/windDebug.c index a4cd11a8..feccaf59 100644 --- a/windows/windDebug.c +++ b/windows/windDebug.c @@ -21,6 +21,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header$"; #endif /* not lint */ #include +#include #include "utils/magic.h" #include "utils/geometry.h" @@ -53,7 +54,7 @@ windPrintWindow(w) LinkedRect *lr; TxPrintf("\nWindow %d: '%s'\n", w->w_wid, w->w_caption); - TxPrintf(" Client %x Surface %x \n", w->w_client, w->w_surfaceID); + TxPrintf(" Client %lx Surface %lx \n", w->w_client, w->w_surfaceID); TxPrintf(" All area (%d, %d) (%d, %d)\n", w->w_allArea.r_xbot, w->w_allArea.r_ybot, @@ -106,9 +107,9 @@ windDump() for (rc = windFirstClientRec; rc != (clientRec * ) NULL; rc = rc->w_nextClient) { - TxPrintf("'%10s' %x %x %x %x\n", rc->w_clientName, - rc->w_create, rc->w_delete, - rc->w_redisplay, rc->w_command); + TxPrintf("'%10s' %lx %lx %lx %lx\n", rc->w_clientName, + (intmax_t) rc->w_create, (intmax_t) rc->w_delete, + (intmax_t) rc->w_redisplay, (intmax_t) rc->w_command); } TxPrintf("\n"); diff --git a/windows/windDisp.c b/windows/windDisp.c index 63f8f40a..91b3533d 100644 --- a/windows/windDisp.c +++ b/windows/windDisp.c @@ -19,6 +19,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header$"; #endif /* not lint */ +#include #include #include "tcltk/tclmagic.h" @@ -337,9 +338,11 @@ WindAreaChanged(w, area) /* will be copied into on the next display redraw. */ if ((w != NULL) && (w->w_backingStore == (ClientData)NULL) && - (!(w->w_flags & WIND_OBSCURED)) && (GrCreateBackingStorePtr != NULL)) - if ((area == (Rect *)NULL) || GEO_SURROUND(&biggerArea, &w->w_screenArea)) + (!(w->w_flags & WIND_OBSCURED)) && (GrCreateBackingStorePtr != NULL)) { + assert(area); // area is non-null + if (GEO_SURROUND(&biggerArea, &w->w_screenArea)) (*GrCreateBackingStorePtr)(w); + } } int