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
537d370536
commit
476bb5474c
|
|
@ -112,7 +112,7 @@ bool CalmaUnique = FALSE; /* If TRUE, then if a cell exists in
|
|||
extern bool CalmaDoLibrary; /* Also used by GDS write */
|
||||
|
||||
extern void calmaUnexpected(int wanted, int got);
|
||||
extern int calmaWriteInitFunc(CellDef *def);
|
||||
extern int calmaWriteInitFunc(CellDef *def, ClientData cdata);
|
||||
|
||||
/*
|
||||
* Scaling.
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ typedef struct {
|
|||
} calmaOutputStruct;
|
||||
|
||||
/* 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 calmaMergePaintFunc(Tile *tile, TileType dinfo, calmaOutputStruct *cos);
|
||||
extern int calmaWriteUseFunc(CellUse *use, FILE *f);
|
||||
|
|
@ -824,7 +824,8 @@ done:
|
|||
|
||||
int
|
||||
calmaWriteInitFunc(
|
||||
CellDef *def)
|
||||
CellDef *def,
|
||||
ClientData cdata)
|
||||
{
|
||||
def->cd_client = (ClientData) 0;
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ extern int calmaPaintLayerNumber;
|
|||
extern int calmaPaintLayerType;
|
||||
|
||||
/* External functions from CalmaWrite.c */
|
||||
extern int calmaWriteInitFunc(CellDef *def);
|
||||
extern int calmaWriteInitFunc(CellDef *def, ClientData cdata);
|
||||
|
||||
/* Structure used by calmaWritePaintFuncZ() and others */
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
|
|||
#include "textio/textio.h"
|
||||
|
||||
/* Forward declarations */
|
||||
extern int cifWriteInitFunc(CellDef *def);
|
||||
extern int cifWriteInitFunc(CellDef *def, ClientData cdata);
|
||||
extern int cifWriteMarkFunc(CellUse *use);
|
||||
extern int cifWritePaintFunc(Tile *tile, TileType dinfo, FILE *f);
|
||||
extern int cifWriteLabelFunc(Tile *tile, TileType dinfo, FILE *f);
|
||||
|
|
@ -206,7 +206,8 @@ CIFWrite(
|
|||
|
||||
int
|
||||
cifWriteInitFunc(
|
||||
CellDef *def)
|
||||
CellDef *def,
|
||||
ClientData cdata)
|
||||
{
|
||||
def->cd_client = (ClientData) 0;
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -905,7 +905,7 @@ CmdExpand(
|
|||
case EXPAND_SELECTION:
|
||||
SelectExpand(windowMask,
|
||||
(doToggle) ? DB_EXPAND_TOGGLE : DB_EXPAND,
|
||||
(Rect *)NULL, FALSE);
|
||||
(Rect *)NULL);
|
||||
break;
|
||||
case EXPAND_OVERLAP:
|
||||
if (doToggle)
|
||||
|
|
@ -913,18 +913,18 @@ CmdExpand(
|
|||
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
||||
DB_EXPAND_TOGGLE | DB_EXPAND_OVERLAP,
|
||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
||||
SelectExpand(windowMask,
|
||||
DB_EXPAND_TOGGLE | DB_EXPAND_OVERLAP,
|
||||
&rootRect, FALSE);
|
||||
SelectExpand(windowMask,
|
||||
DB_EXPAND_TOGGLE | DB_EXPAND_OVERLAP,
|
||||
&rootRect);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
||||
SelectExpand(windowMask,
|
||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||
&rootRect, FALSE);
|
||||
SelectExpand(windowMask,
|
||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||
&rootRect);
|
||||
}
|
||||
break;
|
||||
case EXPAND_SURROUND:
|
||||
|
|
@ -933,18 +933,18 @@ CmdExpand(
|
|||
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
||||
DB_EXPAND_TOGGLE | DB_EXPAND_SURROUND,
|
||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
||||
SelectExpand(windowMask,
|
||||
DB_EXPAND_TOGGLE | DB_EXPAND_SURROUND,
|
||||
&rootRect, TRUE);
|
||||
SelectExpand(windowMask,
|
||||
DB_EXPAND_TOGGLE | DB_EXPAND_SURROUND,
|
||||
&rootRect);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBExpandAll(rootBoxUse, &rootRect, windowMask,
|
||||
DB_EXPAND | DB_EXPAND_SURROUND,
|
||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
||||
SelectExpand(windowMask,
|
||||
DB_EXPAND | DB_EXPAND_SURROUND,
|
||||
&rootRect, TRUE);
|
||||
SelectExpand(windowMask,
|
||||
DB_EXPAND | DB_EXPAND_SURROUND,
|
||||
&rootRect);
|
||||
}
|
||||
break;
|
||||
case EXPAND_ALL:
|
||||
|
|
@ -953,18 +953,18 @@ CmdExpand(
|
|||
DBExpandAll(rootBoxUse, &TiPlaneRect, windowMask,
|
||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
||||
SelectExpand(windowMask,
|
||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||
(Rect *)NULL, FALSE);
|
||||
SelectExpand(windowMask,
|
||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||
(Rect *)NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBExpandAll(rootBoxUse, &TiPlaneRect, windowMask,
|
||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||
cmdExpandFunc, (ClientData)(pointertype)windowMask);
|
||||
SelectExpand(windowMask,
|
||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||
(Rect *)NULL, FALSE);
|
||||
SelectExpand(windowMask,
|
||||
DB_EXPAND | DB_EXPAND_OVERLAP,
|
||||
(Rect *)NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1019,7 +1019,7 @@ CmdSetWindCaption(
|
|||
* edit cell was selected.
|
||||
*/
|
||||
{
|
||||
int cmdWindSet(MagWindow *window);
|
||||
int cmdWindSet(MagWindow *window, ClientData clientData);
|
||||
|
||||
newEditDef = (newEditUse) ? newEditUse->cu_def : NULL;
|
||||
newRootDef = rootDef;
|
||||
|
|
@ -1055,7 +1055,8 @@ CmdSetWindCaption(
|
|||
|
||||
int
|
||||
cmdWindSet(
|
||||
MagWindow *window)
|
||||
MagWindow *window,
|
||||
ClientData clientData)
|
||||
{
|
||||
char caption[200];
|
||||
CellDef *wDef;
|
||||
|
|
|
|||
|
|
@ -777,7 +777,7 @@ CmdUnexpand(
|
|||
switch (option)
|
||||
{
|
||||
case UNEXPAND_SELECTION:
|
||||
SelectExpand(windowMask, DB_UNEXPAND, (Rect *)NULL, FALSE);
|
||||
SelectExpand(windowMask, DB_UNEXPAND, (Rect *)NULL);
|
||||
break;
|
||||
case UNEXPAND_OVERLAP:
|
||||
DBExpandAll(((CellUse *)w->w_surfaceID), &rootRect, windowMask,
|
||||
|
|
@ -785,7 +785,7 @@ CmdUnexpand(
|
|||
cmdUnexpandFunc, (ClientData)(pointertype)windowMask);
|
||||
SelectExpand(windowMask,
|
||||
DB_UNEXPAND | DB_EXPAND_OVERLAP,
|
||||
&rootRect, FALSE);
|
||||
&rootRect);
|
||||
break;
|
||||
case UNEXPAND_SURROUND:
|
||||
DBExpandAll(((CellUse *)w->w_surfaceID), &rootRect, windowMask,
|
||||
|
|
@ -793,7 +793,7 @@ CmdUnexpand(
|
|||
cmdUnexpandFunc, (ClientData)(pointertype)windowMask);
|
||||
SelectExpand(windowMask,
|
||||
DB_UNEXPAND | DB_EXPAND_SURROUND,
|
||||
&rootRect, TRUE);
|
||||
&rootRect);
|
||||
break;
|
||||
case UNEXPAND_ALL:
|
||||
DBExpandAll(((CellUse *)w->w_surfaceID), &TiPlaneRect, windowMask,
|
||||
|
|
|
|||
|
|
@ -239,8 +239,9 @@ DBUpdateStamps(def)
|
|||
}
|
||||
|
||||
int
|
||||
dbStampFunc(cellDef)
|
||||
dbStampFunc(cellDef, cdata)
|
||||
CellDef *cellDef;
|
||||
ClientData cdata;
|
||||
{
|
||||
CellUse *cu;
|
||||
CellDef *cd;
|
||||
|
|
|
|||
|
|
@ -868,7 +868,9 @@ dbwelemGetTransform(use, transform, cdarg)
|
|||
}
|
||||
|
||||
int
|
||||
dbwElementAlways1()
|
||||
dbwElementAlways1(w, clientData)
|
||||
MagWindow *w; /* Unused. */
|
||||
ClientData clientData; /* Unused. */
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -532,7 +532,9 @@ dbwfbGetTransform(use, transform, cdarg)
|
|||
*/
|
||||
|
||||
int
|
||||
dbwfbWindFunc()
|
||||
dbwfbWindFunc(w, clientData)
|
||||
MagWindow *w; /* Unused. */
|
||||
ClientData clientData; /* Unused. */
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,8 +358,9 @@ DBWHLRedrawPrepWindow(MagWindow *window, Rect *area)
|
|||
*/
|
||||
|
||||
int
|
||||
DBWHLRedrawWind(window)
|
||||
DBWHLRedrawWind(window, clientData)
|
||||
MagWindow *window; /* Window in which to redraw highlights. */
|
||||
ClientData clientData; /* Unused. */
|
||||
{
|
||||
int i;
|
||||
DBWclientRec *crec;
|
||||
|
|
|
|||
|
|
@ -1629,7 +1629,8 @@ spcnodeHierVisit(
|
|||
HierContext *hc,
|
||||
EFNode *node,
|
||||
int res,
|
||||
double cap)
|
||||
double cap,
|
||||
ClientData cdata)
|
||||
{
|
||||
HierName *hierName;
|
||||
bool isConnected = FALSE;
|
||||
|
|
|
|||
|
|
@ -147,13 +147,13 @@ NodeRegion *temp_subsnode = NULL; /* Last subsnode found */
|
|||
/* Forward declarations */
|
||||
void extOutputNodes();
|
||||
int extTransTileFunc();
|
||||
int extTransPerimFunc();
|
||||
int extTransPerimFunc(Boundary *, ClientData);
|
||||
int extTransFindSubs();
|
||||
int extTransFindId();
|
||||
void extTermAPFunc();
|
||||
|
||||
int extAnnularTileFunc();
|
||||
int extResistorTileFunc();
|
||||
int extAnnularTileFunc(Tile *, TileType, int, FindRegion *);
|
||||
int extResistorTileFunc(Tile *, TileType, int, FindRegion *);
|
||||
int extSpecialPerimFunc();
|
||||
|
||||
void extFindDuplicateLabels();
|
||||
|
|
@ -2186,10 +2186,11 @@ extDevFindParamMatch(devptr, length, width)
|
|||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
extSDTileFunc(tile, dinfo, pNum)
|
||||
extSDTileFunc(tile, dinfo, pNum, arg)
|
||||
Tile *tile;
|
||||
TileType dinfo; /* (unused) */
|
||||
int pNum;
|
||||
FindRegion *arg;
|
||||
{
|
||||
LinkedTile *newdevtile;
|
||||
|
||||
|
|
@ -3948,8 +3949,9 @@ extTermAPFunc(tile, dinfo, eapd)
|
|||
*/
|
||||
|
||||
int
|
||||
extTransPerimFunc(bp)
|
||||
extTransPerimFunc(bp, cdata)
|
||||
Boundary *bp;
|
||||
ClientData cdata;
|
||||
{
|
||||
TileType tinside, toutside, dinfo;
|
||||
Tile *tile;
|
||||
|
|
@ -4226,10 +4228,11 @@ extTransPerimFunc(bp)
|
|||
*/
|
||||
|
||||
int
|
||||
extAnnularTileFunc(tile, dinfo, pNum)
|
||||
extAnnularTileFunc(tile, dinfo, pNum, arg)
|
||||
Tile *tile;
|
||||
TileType dinfo;
|
||||
int pNum;
|
||||
FindRegion *arg;
|
||||
{
|
||||
TileTypeBitMask mask;
|
||||
TileType loctype;
|
||||
|
|
@ -4276,10 +4279,11 @@ extAnnularTileFunc(tile, dinfo, pNum)
|
|||
*/
|
||||
|
||||
int
|
||||
extResistorTileFunc(tile, dinfo, pNum)
|
||||
extResistorTileFunc(tile, dinfo, pNum, arg)
|
||||
Tile *tile;
|
||||
TileType dinfo;
|
||||
int pNum;
|
||||
FindRegion *arg;
|
||||
{
|
||||
TileTypeBitMask mask;
|
||||
TileType loctype;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ typedef struct _linkedDef {
|
|||
Stack *extDefStack;
|
||||
|
||||
/* Forward declarations */
|
||||
int extDefInitFunc();
|
||||
int extDefInitFunc(CellDef *, ClientData);
|
||||
void extDefPush();
|
||||
void extDefIncremental();
|
||||
void extParents();
|
||||
|
|
@ -396,8 +396,9 @@ ExtAll(rootUse)
|
|||
* rooted at a particular def.
|
||||
*/
|
||||
int
|
||||
extDefInitFunc(def)
|
||||
extDefInitFunc(def, cdata)
|
||||
CellDef *def;
|
||||
ClientData cdata;
|
||||
{
|
||||
def->cd_client = (ClientData) 0;
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -289,8 +289,9 @@ ExtTimes(rootUse, f)
|
|||
*/
|
||||
|
||||
int
|
||||
extTimesInitFunc(use)
|
||||
extTimesInitFunc(use, cdata)
|
||||
CellUse *use;
|
||||
ClientData cdata;
|
||||
{
|
||||
CellDef *def = use->cu_def;
|
||||
struct cellStats *cs;
|
||||
|
|
|
|||
Loading…
Reference in New Issue