ouster@UCBARPA.BERKELEY.EDU (John Ousterhout) (01/09/87)
The previous bug report that we mailed/sent out about the Magic resistance bug was pretty sketchy as to the fix. Here's a more detailed description of how to fix it, including diffs of relevant files. I'm also including at the end of this message two additional notices about recently-found major Magic bugs and their fixes. For those of you who could care less about Magic, apologies for such a lengthy piece of electronic garbage. ---------------------------------------------------------------------- Magic Bug Report April 25, 1986 Symptoms: Magic incorrectly estimates resistances. In addition, the area and perimeter information in .ext files is wrong (this is the cause of the bad resistance estimates). Fix: The problem is that any material that has not been assigned a "resist class" automatically has its area and perimeter and area lumped into resist class zero. The result is that the perimeters and areas for resist class zero are consistently overestimated. This all happens because the default resist class for all types is set to 0. The fix is to edit the files ExtBasic.c and ExtTech.c to change the default resist class to -1, and also to check for a -1 resist class before adding in areas and perimeters, skipping the addition for -1 resist classes. Here are a set of diffs for the two files: ------- ExtBasic.c ------- 1026c1026,1027 < extResistArea[resistClass] += area; --- > if (resistClass != -1) > extResistArea[resistClass] += area; 1051,1052c1052,1055 < if (cap = ExtCurStyle->exts_perimCap[type][t]) reg->nreg_cap += cap * len; < if (TTMaskHasType(resMask, t)) extResistPerim[resistClass] += len; --- > if (cap = ExtCurStyle->exts_perimCap[type][t]) > reg->nreg_cap += cap * len; > if (TTMaskHasType(resMask, t) && resistClass != -1) > extResistPerim[resistClass] += len; 1070,1071c1073,1076 < if (cap = ExtCurStyle->exts_perimCap[type][t]) reg->nreg_cap += cap * len; < if (TTMaskHasType(resMask, t)) extResistPerim[resistClass] += len; --- > if (cap = ExtCurStyle->exts_perimCap[type][t]) > reg->nreg_cap += cap * len; > if (TTMaskHasType(resMask, t) && resistClass != -1) > extResistPerim[resistClass] += len; 1089,1090c1094,1097 < if (cap = ExtCurStyle->exts_perimCap[type][t]) reg->nreg_cap += cap * len; < if (TTMaskHasType(resMask, t)) extResistPerim[resistClass] += len; --- > if (cap = ExtCurStyle->exts_perimCap[type][t]) > reg->nreg_cap += cap * len; > if (TTMaskHasType(resMask, t) && resistClass != -1) > extResistPerim[resistClass] += len; 1108,1109c1115,1118 < if (cap = ExtCurStyle->exts_perimCap[type][t]) reg->nreg_cap += cap * len; < if (TTMaskHasType(resMask, t)) extResistPerim[resistClass] += len; --- > if (cap = ExtCurStyle->exts_perimCap[type][t]) > reg->nreg_cap += cap * len; > if (TTMaskHasType(resMask, t) && resistClass != -1) > extResistPerim[resistClass] += len; ------- ExtTech.c ------- 247c247 < style->exts_typeToResistClass[r] = 0; --- > style->exts_typeToResistClass[r] = -1; ---------------------------------------------------------------------- Magic Bug Report August 3, 1986 Symptoms: Magic core dumps during cell selection. Typically, this happens when you delete a cell, delete it, and then immediately select another cell without moving the cursor. This bug only tends to manifest itself on Suns. Fix: Make two changes in the procedure CmdSelect in CmdRS.c: at about line 639, change the code to look like the following: -------------------------- 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 * bigger thing to be selected. */ static int lastCommand; /* Serial number of last command: the next * bigger thing is only selected when there * are several select commands in a row. */ static Rect chunkSelection; /* Used to remember the size of the last chunk * selected. */ -------------------------- At about line 802, change the code to look like the following: -------------------------- /* See if we're pointing at the same place as we were the last time * this command was invoked, and if this command immediately follows * another selection comand. */ if (GEO_ENCLOSE(&cmd->tx_p, &lastArea) && (lastCommand+1 == TxCommandNumber)) samePlace = TRUE; else samePlace = FALSE; lastArea.r_xbot = cmd->tx_p.p_x - MARGIN; lastArea.r_ybot = cmd->tx_p.p_y - MARGIN; lastArea.r_xtop = cmd->tx_p.p_x + MARGIN; lastArea.r_ytop = cmd->tx_p.p_y + MARGIN; lastCommand = TxCommandNumber; -------------------------- ---------------------------------------------------------------------- Magic Bug Report November 24, 1986 Symptoms: When generating Calma for an array whose bounding box includes the origin, the reference points get screwed up and incorrect Stream is generated. Fix: Below is a diff of the old version of CalmaWrite.c, followed by the relevant lines of the new version. Substitute the new for the old (except for the "!" characters which were added to indicate the lines that changed). *** OLD CalmaWrite.c Mon Nov 3 13:10:29 1986 --- CalmaWrite.c Fri Oct 3 17:21:27 1986 *************** *** 550,569 **** if (isArray) { /* Column reference point */ ! p.p_x = use->cu_xsep; p.p_y = 0; GeoTransPoint(t, &p, &p2); ! p2.p_x *= calmaWriteScale * cols; ! p2.p_y *= calmaWriteScale * cols; calmaOutI4(p2.p_x, f); calmaOutI4(p2.p_y, f); /* Row reference point */ p.p_x = 0; ! p.p_y = use->cu_ysep; GeoTransPoint(t, &p, &p2); ! p2.p_x *= calmaWriteScale * rows; ! p2.p_y *= calmaWriteScale * rows; calmaOutI4(p2.p_x, f); calmaOutI4(p2.p_y, f); } --- 550,569 ---- if (isArray) { /* Column reference point */ ! p.p_x = use->cu_xsep * cols; p.p_y = 0; GeoTransPoint(t, &p, &p2); ! p2.p_x *= calmaWriteScale; ! p2.p_y *= calmaWriteScale; calmaOutI4(p2.p_x, f); calmaOutI4(p2.p_y, f); /* Row reference point */ p.p_x = 0; ! p.p_y = use->cu_ysep * rows; GeoTransPoint(t, &p, &p2); ! p2.p_x *= calmaWriteScale; ! p2.p_y *= calmaWriteScale; calmaOutI4(p2.p_x, f); calmaOutI4(p2.p_y, f); }