Add ClientData parameter to indirect-call callbacks for WASM
WASM call_indirect enforces an exact type match between the caller and the callee. Many Magic callbacks had K&R-style () forward declarations and a single-argument definition, but were passed to iterators that always push a trailing ClientData argument. Native builds tolerated the mismatch via loose prototypes; WASM traps with "indirect call signature mismatch". Added the missing ClientData (or, where the concrete type is known, FindRegion *) parameter to: * calma/CalmaRead.c, calma/CalmaWrite.c, calma/CalmaWriteZ.c — calmaWriteInitFunc * cif/CIFwrite.c — cifWriteInitFunc * commands/CmdSubrs.c — cmdWindSet * database/DBtimestmp.c — dbStampFunc * dbwind/DBWelement.c — dbwElementAlways1 * dbwind/DBWfdback.c — dbwfbWindFunc * dbwind/DBWhlights.c — DBWHLRedrawWind * ext2spice/ext2hier.c — spcnodeHierVisit * extract/ExtBasic.c — extSDTileFunc, extTransPerimFunc, extAnnularTileFunc, extResistorTileFunc * extract/ExtMain.c — extDefInitFunc * extract/ExtTimes.c — extTimesInitFunc Also adjusted commands/CmdE.c and commands/CmdTZ.c: SelectExpand was being called with four arguments (the legacy surroundFlag), but its real signature has been three arguments for years (the surround mode is encoded in the expandType bit). The fourth argument was redundant (DB_EXPAND_SURROUND in arg 2 is the source of truth) and rejected by WASM. Native behavior is unchanged. The added parameters are unused in the function bodies; they exist only to satisfy the indirect-call signature.
This commit is contained in:
parent
2b922457a5
commit
58174e2a97
|
|
@ -112,7 +112,7 @@ bool CalmaUnique = FALSE; /* If TRUE, then if a cell exists in
|
||||||
extern bool CalmaDoLibrary; /* Also used by GDS write */
|
extern bool CalmaDoLibrary; /* Also used by GDS write */
|
||||||
|
|
||||||
extern void calmaUnexpected(int wanted, int got);
|
extern void calmaUnexpected(int wanted, int got);
|
||||||
extern int calmaWriteInitFunc(CellDef *def);
|
extern int calmaWriteInitFunc(CellDef *def, ClientData cdata);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scaling.
|
* Scaling.
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ typedef struct {
|
||||||
} calmaOutputStruct;
|
} calmaOutputStruct;
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
extern int calmaWriteInitFunc(CellDef *def);
|
extern int calmaWriteInitFunc(CellDef *def, ClientData cdata);
|
||||||
extern int calmaWritePaintFunc(Tile *tile, TileType dinfo, calmaOutputStruct *cos);
|
extern int calmaWritePaintFunc(Tile *tile, TileType dinfo, calmaOutputStruct *cos);
|
||||||
extern int calmaMergePaintFunc(Tile *tile, TileType dinfo, calmaOutputStruct *cos);
|
extern int calmaMergePaintFunc(Tile *tile, TileType dinfo, calmaOutputStruct *cos);
|
||||||
extern int calmaWriteUseFunc(CellUse *use, FILE *f);
|
extern int calmaWriteUseFunc(CellUse *use, FILE *f);
|
||||||
|
|
@ -824,7 +824,8 @@ done:
|
||||||
|
|
||||||
int
|
int
|
||||||
calmaWriteInitFunc(
|
calmaWriteInitFunc(
|
||||||
CellDef *def)
|
CellDef *def,
|
||||||
|
ClientData cdata)
|
||||||
{
|
{
|
||||||
def->cd_client = (ClientData) 0;
|
def->cd_client = (ClientData) 0;
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ extern int calmaPaintLayerNumber;
|
||||||
extern int calmaPaintLayerType;
|
extern int calmaPaintLayerType;
|
||||||
|
|
||||||
/* External functions from CalmaWrite.c */
|
/* External functions from CalmaWrite.c */
|
||||||
extern int calmaWriteInitFunc(CellDef *def);
|
extern int calmaWriteInitFunc(CellDef *def, ClientData cdata);
|
||||||
|
|
||||||
/* Structure used by calmaWritePaintFuncZ() and others */
|
/* Structure used by calmaWritePaintFuncZ() and others */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
||||||
#include "textio/textio.h"
|
#include "textio/textio.h"
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
extern int cifWriteInitFunc(CellDef *def);
|
extern int cifWriteInitFunc(CellDef *def, ClientData cdata);
|
||||||
extern int cifWriteMarkFunc(CellUse *use);
|
extern int cifWriteMarkFunc(CellUse *use);
|
||||||
extern int cifWritePaintFunc(Tile *tile, TileType dinfo, FILE *f);
|
extern int cifWritePaintFunc(Tile *tile, TileType dinfo, FILE *f);
|
||||||
extern int cifWriteLabelFunc(Tile *tile, TileType dinfo, FILE *f);
|
extern int cifWriteLabelFunc(Tile *tile, TileType dinfo, FILE *f);
|
||||||
|
|
@ -206,7 +206,8 @@ CIFWrite(
|
||||||
|
|
||||||
int
|
int
|
||||||
cifWriteInitFunc(
|
cifWriteInitFunc(
|
||||||
CellDef *def)
|
CellDef *def,
|
||||||
|
ClientData cdata)
|
||||||
{
|
{
|
||||||
def->cd_client = (ClientData) 0;
|
def->cd_client = (ClientData) 0;
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
||||||
|
|
@ -905,7 +905,7 @@ CmdExpand(
|
||||||
case EXPAND_SELECTION:
|
case EXPAND_SELECTION:
|
||||||
SelectExpand(windowMask,
|
SelectExpand(windowMask,
|
||||||
(doToggle) ? DB_EXPAND_TOGGLE : DB_EXPAND,
|
(doToggle) ? DB_EXPAND_TOGGLE : DB_EXPAND,
|
||||||
(Rect *)NULL, FALSE);
|
(Rect *)NULL);
|
||||||
break;
|
break;
|
||||||
case EXPAND_OVERLAP:
|
case EXPAND_OVERLAP:
|
||||||
if (doToggle)
|
if (doToggle)
|
||||||
|
|
@ -913,18 +913,18 @@ CmdExpand(
|
||||||
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
||||||
DB_EXPAND_TOGGLE | DB_EXPAND_OVERLAP,
|
DB_EXPAND_TOGGLE | DB_EXPAND_OVERLAP,
|
||||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
||||||
SelectExpand(windowMask,
|
SelectExpand(windowMask,
|
||||||
DB_EXPAND_TOGGLE | DB_EXPAND_OVERLAP,
|
DB_EXPAND_TOGGLE | DB_EXPAND_OVERLAP,
|
||||||
&rootRect, FALSE);
|
&rootRect);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
||||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
||||||
SelectExpand(windowMask,
|
SelectExpand(windowMask,
|
||||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||||
&rootRect, FALSE);
|
&rootRect);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXPAND_SURROUND:
|
case EXPAND_SURROUND:
|
||||||
|
|
@ -933,18 +933,18 @@ CmdExpand(
|
||||||
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
||||||
DB_EXPAND_TOGGLE | DB_EXPAND_SURROUND,
|
DB_EXPAND_TOGGLE | DB_EXPAND_SURROUND,
|
||||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
||||||
SelectExpand(windowMask,
|
SelectExpand(windowMask,
|
||||||
DB_EXPAND_TOGGLE | DB_EXPAND_SURROUND,
|
DB_EXPAND_TOGGLE | DB_EXPAND_SURROUND,
|
||||||
&rootRect, TRUE);
|
&rootRect);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
||||||
DB_EXPAND | DB_EXPAND_SURROUND,
|
DB_EXPAND | DB_EXPAND_SURROUND,
|
||||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
||||||
SelectExpand(windowMask,
|
SelectExpand(windowMask,
|
||||||
DB_EXPAND | DB_EXPAND_SURROUND,
|
DB_EXPAND | DB_EXPAND_SURROUND,
|
||||||
&rootRect, TRUE);
|
&rootRect);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXPAND_ALL:
|
case EXPAND_ALL:
|
||||||
|
|
@ -953,18 +953,18 @@ CmdExpand(
|
||||||
DBExpandAll(rootBoxUse, &TiPlaneRect, windowMask,
|
DBExpandAll(rootBoxUse, &TiPlaneRect, windowMask,
|
||||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
||||||
SelectExpand(windowMask,
|
SelectExpand(windowMask,
|
||||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||||
(Rect *)NULL, FALSE);
|
(Rect *)NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DBExpandAll(rootBoxUse, &TiPlaneRect, windowMask,
|
DBExpandAll(rootBoxUse, &TiPlaneRect, windowMask,
|
||||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
||||||
SelectExpand(windowMask,
|
SelectExpand(windowMask,
|
||||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||||
(Rect *)NULL, FALSE);
|
(Rect *)NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1019,7 +1019,7 @@ CmdSetWindCaption(
|
||||||
* edit cell was selected.
|
* edit cell was selected.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int cmdWindSet(MagWindow *window);
|
int cmdWindSet(MagWindow *window, ClientData clientData);
|
||||||
|
|
||||||
newEditDef = (newEditUse) ? newEditUse->cu_def : NULL;
|
newEditDef = (newEditUse) ? newEditUse->cu_def : NULL;
|
||||||
newRootDef = rootDef;
|
newRootDef = rootDef;
|
||||||
|
|
@ -1055,7 +1055,8 @@ CmdSetWindCaption(
|
||||||
|
|
||||||
int
|
int
|
||||||
cmdWindSet(
|
cmdWindSet(
|
||||||
MagWindow *window)
|
MagWindow *window,
|
||||||
|
ClientData clientData)
|
||||||
{
|
{
|
||||||
char caption[200];
|
char caption[200];
|
||||||
CellDef *wDef;
|
CellDef *wDef;
|
||||||
|
|
|
||||||
|
|
@ -777,7 +777,7 @@ CmdUnexpand(
|
||||||
switch (option)
|
switch (option)
|
||||||
{
|
{
|
||||||
case UNEXPAND_SELECTION:
|
case UNEXPAND_SELECTION:
|
||||||
SelectExpand(windowMask, DB_UNEXPAND, (Rect *)NULL, FALSE);
|
SelectExpand(windowMask, DB_UNEXPAND, (Rect *)NULL);
|
||||||
break;
|
break;
|
||||||
case UNEXPAND_OVERLAP:
|
case UNEXPAND_OVERLAP:
|
||||||
DBExpandAll(((CellUse *)w->w_surfaceID), &rootRect, windowMask,
|
DBExpandAll(((CellUse *)w->w_surfaceID), &rootRect, windowMask,
|
||||||
|
|
@ -785,7 +785,7 @@ CmdUnexpand(
|
||||||
cmdUnexpandFunc, (ClientData)(pointertype)windowMask);
|
cmdUnexpandFunc, (ClientData)(pointertype)windowMask);
|
||||||
SelectExpand(windowMask,
|
SelectExpand(windowMask,
|
||||||
DB_UNEXPAND | DB_EXPAND_OVERLAP,
|
DB_UNEXPAND | DB_EXPAND_OVERLAP,
|
||||||
&rootRect, FALSE);
|
&rootRect);
|
||||||
break;
|
break;
|
||||||
case UNEXPAND_SURROUND:
|
case UNEXPAND_SURROUND:
|
||||||
DBExpandAll(((CellUse *)w->w_surfaceID), &rootRect, windowMask,
|
DBExpandAll(((CellUse *)w->w_surfaceID), &rootRect, windowMask,
|
||||||
|
|
@ -793,7 +793,7 @@ CmdUnexpand(
|
||||||
cmdUnexpandFunc, (ClientData)(pointertype)windowMask);
|
cmdUnexpandFunc, (ClientData)(pointertype)windowMask);
|
||||||
SelectExpand(windowMask,
|
SelectExpand(windowMask,
|
||||||
DB_UNEXPAND | DB_EXPAND_SURROUND,
|
DB_UNEXPAND | DB_EXPAND_SURROUND,
|
||||||
&rootRect, TRUE);
|
&rootRect);
|
||||||
break;
|
break;
|
||||||
case UNEXPAND_ALL:
|
case UNEXPAND_ALL:
|
||||||
DBExpandAll(((CellUse *)w->w_surfaceID), &TiPlaneRect, windowMask,
|
DBExpandAll(((CellUse *)w->w_surfaceID), &TiPlaneRect, windowMask,
|
||||||
|
|
|
||||||
|
|
@ -239,8 +239,9 @@ DBUpdateStamps(def)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dbStampFunc(cellDef)
|
dbStampFunc(cellDef, cdata)
|
||||||
CellDef *cellDef;
|
CellDef *cellDef;
|
||||||
|
ClientData cdata;
|
||||||
{
|
{
|
||||||
CellUse *cu;
|
CellUse *cu;
|
||||||
CellDef *cd;
|
CellDef *cd;
|
||||||
|
|
|
||||||
|
|
@ -868,7 +868,9 @@ dbwelemGetTransform(use, transform, cdarg)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dbwElementAlways1()
|
dbwElementAlways1(w, clientData)
|
||||||
|
MagWindow *w; /* Unused. */
|
||||||
|
ClientData clientData; /* Unused. */
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -532,7 +532,9 @@ dbwfbGetTransform(use, transform, cdarg)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
dbwfbWindFunc()
|
dbwfbWindFunc(w, clientData)
|
||||||
|
MagWindow *w; /* Unused. */
|
||||||
|
ClientData clientData; /* Unused. */
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -358,8 +358,9 @@ DBWHLRedrawPrepWindow(MagWindow *window, Rect *area)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
DBWHLRedrawWind(window)
|
DBWHLRedrawWind(window, clientData)
|
||||||
MagWindow *window; /* Window in which to redraw highlights. */
|
MagWindow *window; /* Window in which to redraw highlights. */
|
||||||
|
ClientData clientData; /* Unused. */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
DBWclientRec *crec;
|
DBWclientRec *crec;
|
||||||
|
|
|
||||||
|
|
@ -1568,7 +1568,8 @@ spcnodeHierVisit(
|
||||||
HierContext *hc,
|
HierContext *hc,
|
||||||
EFNode *node,
|
EFNode *node,
|
||||||
int res,
|
int res,
|
||||||
double cap)
|
double cap,
|
||||||
|
ClientData cdata)
|
||||||
{
|
{
|
||||||
HierName *hierName;
|
HierName *hierName;
|
||||||
bool isConnected = FALSE;
|
bool isConnected = FALSE;
|
||||||
|
|
|
||||||
|
|
@ -147,13 +147,13 @@ NodeRegion *temp_subsnode = NULL; /* Last subsnode found */
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
void extOutputNodes();
|
void extOutputNodes();
|
||||||
int extTransTileFunc();
|
int extTransTileFunc();
|
||||||
int extTransPerimFunc();
|
int extTransPerimFunc(Boundary *, ClientData);
|
||||||
int extTransFindSubs();
|
int extTransFindSubs();
|
||||||
int extTransFindId();
|
int extTransFindId();
|
||||||
void extTermAPFunc();
|
void extTermAPFunc();
|
||||||
|
|
||||||
int extAnnularTileFunc();
|
int extAnnularTileFunc(Tile *, TileType, int, FindRegion *);
|
||||||
int extResistorTileFunc();
|
int extResistorTileFunc(Tile *, TileType, int, FindRegion *);
|
||||||
int extSpecialPerimFunc();
|
int extSpecialPerimFunc();
|
||||||
|
|
||||||
void extFindDuplicateLabels();
|
void extFindDuplicateLabels();
|
||||||
|
|
@ -2186,10 +2186,11 @@ extDevFindParamMatch(devptr, length, width)
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
extSDTileFunc(tile, dinfo, pNum)
|
extSDTileFunc(tile, dinfo, pNum, arg)
|
||||||
Tile *tile;
|
Tile *tile;
|
||||||
TileType dinfo; /* (unused) */
|
TileType dinfo; /* (unused) */
|
||||||
int pNum;
|
int pNum;
|
||||||
|
FindRegion *arg;
|
||||||
{
|
{
|
||||||
LinkedTile *newdevtile;
|
LinkedTile *newdevtile;
|
||||||
|
|
||||||
|
|
@ -3948,8 +3949,9 @@ extTermAPFunc(tile, dinfo, eapd)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
extTransPerimFunc(bp)
|
extTransPerimFunc(bp, cdata)
|
||||||
Boundary *bp;
|
Boundary *bp;
|
||||||
|
ClientData cdata;
|
||||||
{
|
{
|
||||||
TileType tinside, toutside, dinfo;
|
TileType tinside, toutside, dinfo;
|
||||||
Tile *tile;
|
Tile *tile;
|
||||||
|
|
@ -4226,10 +4228,11 @@ extTransPerimFunc(bp)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
extAnnularTileFunc(tile, dinfo, pNum)
|
extAnnularTileFunc(tile, dinfo, pNum, arg)
|
||||||
Tile *tile;
|
Tile *tile;
|
||||||
TileType dinfo;
|
TileType dinfo;
|
||||||
int pNum;
|
int pNum;
|
||||||
|
FindRegion *arg;
|
||||||
{
|
{
|
||||||
TileTypeBitMask mask;
|
TileTypeBitMask mask;
|
||||||
TileType loctype;
|
TileType loctype;
|
||||||
|
|
@ -4276,10 +4279,11 @@ extAnnularTileFunc(tile, dinfo, pNum)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
extResistorTileFunc(tile, dinfo, pNum)
|
extResistorTileFunc(tile, dinfo, pNum, arg)
|
||||||
Tile *tile;
|
Tile *tile;
|
||||||
TileType dinfo;
|
TileType dinfo;
|
||||||
int pNum;
|
int pNum;
|
||||||
|
FindRegion *arg;
|
||||||
{
|
{
|
||||||
TileTypeBitMask mask;
|
TileTypeBitMask mask;
|
||||||
TileType loctype;
|
TileType loctype;
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ typedef struct _linkedDef {
|
||||||
Stack *extDefStack;
|
Stack *extDefStack;
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
int extDefInitFunc();
|
int extDefInitFunc(CellDef *, ClientData);
|
||||||
void extDefPush();
|
void extDefPush();
|
||||||
void extDefIncremental();
|
void extDefIncremental();
|
||||||
void extParents();
|
void extParents();
|
||||||
|
|
@ -396,8 +396,9 @@ ExtAll(rootUse)
|
||||||
* rooted at a particular def.
|
* rooted at a particular def.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
extDefInitFunc(def)
|
extDefInitFunc(def, cdata)
|
||||||
CellDef *def;
|
CellDef *def;
|
||||||
|
ClientData cdata;
|
||||||
{
|
{
|
||||||
def->cd_client = (ClientData) 0;
|
def->cd_client = (ClientData) 0;
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
||||||
|
|
@ -289,8 +289,9 @@ ExtTimes(rootUse, f)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
extTimesInitFunc(use)
|
extTimesInitFunc(use, cdata)
|
||||||
CellUse *use;
|
CellUse *use;
|
||||||
|
ClientData cdata;
|
||||||
{
|
{
|
||||||
CellDef *def = use->cu_def;
|
CellDef *def = use->cu_def;
|
||||||
struct cellStats *cs;
|
struct cellStats *cs;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue