diff --git a/cif/CIFsee.c b/cif/CIFsee.c index 5713247a..8eff6a5b 100644 --- a/cif/CIFsee.c +++ b/cif/CIFsee.c @@ -21,6 +21,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include "tcltk/tclmagic.h" #include "utils/magic.h" #include "utils/geometry.h" #include "tiles/tile.h" @@ -422,10 +423,11 @@ typedef struct { } coverstats; void -CIFCoverageLayer(rootDef, area, layer) +CIFCoverageLayer(rootDef, area, layer, dolist) CellDef *rootDef; /* Def in which to compute CIF coverage */ Rect *area; /* Area in which to compute coverage */ char *layer; /* CIF layer for coverage computation. */ + bool dolist; /* If TRUE, report only the value, in decimal */ { coverstats cstats; int i, scale; @@ -482,12 +484,26 @@ CIFCoverageLayer(rootDef, area, layer) atotal = (long long)(cstats.bounds.r_xtop - cstats.bounds.r_xbot); atotal *= (long long)(cstats.bounds.r_ytop - cstats.bounds.r_ybot); - TxPrintf("%s Area = %lld CIF units^2\n", doBox ? "Cursor Box" : + if (dolist) + { +#ifdef MAGIC_WRAPPER + Tcl_Obj *pobj; + + pobj = Tcl_NewDoubleObj((double)fcover); + Tcl_SetObjResult(magicinterp, pobj); +#else + TxPrintf("%g\n", fcover); +#endif + } + else + { + TxPrintf("%s Area = %lld CIF units^2\n", doBox ? "Cursor Box" : "Cell", btotal); - TxPrintf("Layer Bounding Area = %lld CIF units^2\n", atotal); - TxPrintf("Layer Total Area = %lld CIF units^2\n", cstats.coverage); - TxPrintf("Coverage in %s = %1.1f%%\n", doBox ? "box" : + TxPrintf("Layer Bounding Area = %lld CIF units^2\n", atotal); + TxPrintf("Layer Total Area = %lld CIF units^2\n", cstats.coverage); + TxPrintf("Coverage in %s = %1.1f%%\n", doBox ? "box" : "cell", 100.0 * fcover); + } } int diff --git a/commands/CmdCD.c b/commands/CmdCD.c index 32c9d821..a4a2efb7 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -1304,6 +1304,7 @@ CmdCif(w, cmd) bool doforall = FALSE; float curscale; int argc = cmd->tx_argc; + int argshift; char **argv = cmd->tx_argv; static char *cmdCifWarnOptions[] = { "default", "none", "align", @@ -1459,10 +1460,10 @@ CmdCif(w, cmd) TxError("Box requested but no cursor box exists\n"); return; } - CIFCoverageLayer(rootDef, &box, argv[2]); + CIFCoverageLayer(rootDef, &box, argv[2], dolist); } else if (argc == 3) - CIFCoverageLayer(rootDef, &rootDef->cd_bbox, argv[2]); + CIFCoverageLayer(rootDef, &rootDef->cd_bbox, argv[2], dolist); else goto wrongNumArgs;