diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c index 910ca773..9d6ee446 100644 --- a/ext2spice/ext2spice.c +++ b/ext2spice/ext2spice.c @@ -1122,7 +1122,7 @@ runexttospice: if (flatFlags & EF_FLATCAPS) EFVisitCaps(spccapVisit, (ClientData) NULL); - EFVisitResists(spcresistVisit, (ClientData) NULL); + EFVisitResists(spcresistVisit, PTR2CD(NULL)); EFVisitSubcircuits(subcktVisit, (ClientData) NULL); /* Visit nodes to find the substrate node */ @@ -1298,7 +1298,7 @@ main( if (flatFlags & EF_FLATCAPS) EFVisitCaps(spccapVisit, (ClientData) NULL); - EFVisitResists(spcresistVisit, (ClientData) NULL); + EFVisitResists(spcresistVisit, PTR2CD(NULL)); EFVisitSubcircuits(subcktVisit, (ClientData) NULL); esSpiceCapNode = StrDup((char **)NULL, esSpiceDefaultGnd); EFVisitNodes(spcnodeVisit, (ClientData) NULL); @@ -3653,11 +3653,12 @@ spccapVisit( * ---------------------------------------------------------------------------- */ +/* ARGSUSED */ /* @typedef cb_extflat_visitresists_t (UNUSED) */ int spcresistVisit( - HierName *hierName1, - HierName *hierName2, + const HierName *hierName1, + const HierName *hierName2, float res, ClientData cdata) /* unused */ { diff --git a/ext2spice/ext2spice.h b/ext2spice/ext2spice.h index 547b2b67..8eaba2f2 100644 --- a/ext2spice/ext2spice.h +++ b/ext2spice/ext2spice.h @@ -25,7 +25,7 @@ extern int spccapVisit(HierName *hierName1, HierName *hierName2, double cap, Cli extern int spcdevVisit(Dev *dev, HierContext *hc, float scale, Transform *trans, ClientData cdata); /* @typedef cb_extflat_visitdevs_t (UNUSED) */ extern int spcnodeVisit(EFNode *node, int res, double cap, ClientData cdata); /* @typedef cb_extflat_visitnodes_t (UNUSED) */ extern int subcktVisit(Use *use, HierName *hierName, bool is_top); /* @typedef cb_extflat_visitsubcircuits_t */ -extern int spcresistVisit(HierName *hierName1, HierName *hierName2, float res, ClientData cdata); /* @typedef cb_extflat_visitresists_t (UNUSED) */ +extern int spcresistVisit(const HierName *hierName1, const HierName *hierName2, float res, ClientData cdata); /* @typedef cb_extflat_visitresists_t (UNUSED) */ extern int devMergeVisit(Dev *dev, HierContext *hc, float scale, Transform *trans, ClientData cdata); /* @typedef cb_extflat_visitdevs_t (UNUSED) */ extern int devDistJunctVisit(Dev *dev, HierContext *hc, float scale, Transform *trans, ClientData cdata); /* @typedef cb_extflat_visitdevs_t (UNUSED) */ extern int spcsubVisit(EFNode *node, int res, double cap, ClientData cdata); /* @typedef cb_extflat_visitnodes_t (char** resstr) */ diff --git a/extcheck/extcheck.c b/extcheck/extcheck.c index e2760966..ba78530f 100644 --- a/extcheck/extcheck.c +++ b/extcheck/extcheck.c @@ -54,7 +54,7 @@ int ecNumNodeResists; int nodeVisit(EFNode *node, int res, double cap, ClientData cdata); /* @typedef cb_extflat_visitnodes_t (UNUSED) */ int devVisit(Dev *dev, HierContext *hc, float scale, Transform *trans, ClientData cdata); /* @typedef cb_extflat_visitdevs_t (UNUSED) */ int capVisit(HierName *hn1, HierName *hn2, double cap, ClientData cdata); /* @typedef cb_extflat_visitcaps_t (UNUSED) */ -int resistVisit(HierName *hn1, HierName *hn2, float res, ClientData cdata); /* @typedef cb_extflat_visitresists_t (UNUSED) */ +int resistVisit(const HierName *hn1, const HierName *hn2, float res, ClientData cdata); /* @typedef cb_extflat_visitresists_t (UNUSED) */ /* * ---------------------------------------------------------------------------- @@ -89,7 +89,7 @@ main(int argc, char *argv[]) if (IS_FINITE_F(EFCapThreshold)) EFVisitCaps(capVisit, (ClientData) NULL); if (EFResistThreshold != INFINITE_THRESHOLD) - EFVisitResists(resistVisit, (ClientData) NULL); + EFVisitResists(resistVisit, PTR2CD(NULL)); EFVisitNodes(nodeVisit, (ClientData) NULL); #ifdef free_all_mem @@ -181,8 +181,8 @@ capVisit( /* @typedef cb_extflat_visitresists_t (UNUSED) */ int resistVisit( - HierName *hn1, - HierName *hn2, /* UNUSED */ + const HierName *hn1, + const HierName *hn2,/* UNUSED */ float res, ClientData cdata) /* UNUSED */ { diff --git a/extflat/EFvisit.c b/extflat/EFvisit.c index 87e28f8f..b8a831b2 100644 --- a/extflat/EFvisit.c +++ b/extflat/EFvisit.c @@ -456,12 +456,14 @@ skip: * Must be called after EFFlatBuild(). * For each resistor in the circuit, call the user-supplied procedure * (*resProc)(), which should be of the following form, where hn1 and - * hn2 are the HierNames of the two nodes connected by the resistor. + * hn2 are the HierNames of the two nodes connected by the resistor + * see also typedef cb_extflat_visitresists_t: * - * (*resProc)(hn1, hn2, resistance, cdata) - * HierName *hn1, *hn2; - * int resistance; - * ClientData cdata; + * int (*resProc)( + * const HierName *hn1, + * const HierName *hn2, + * float resistance, + * ClientData cdata) * { * } * @@ -482,15 +484,15 @@ skip: */ int -EFVisitResists(resProc, cdata) - int (*resProc)(); - ClientData cdata; +EFVisitResists( + const cb_extflat_visitresists_t resProc, + ClientData cdata) { CallArg ca; - ca.ca_proc = resProc; + ca.ca_proc = (int (*)()) resProc; ca.ca_cdata = cdata; - return efVisitResists(&efFlatContext, (ClientData) &ca); + return efVisitResists(&efFlatContext, &ca); } /* @@ -585,7 +587,7 @@ efVisitSingleResist(hc, name1, name2, res, ca) return (*ca->ca_proc)(n1->efnode_name->efnn_hier, n2->efnode_name->efnn_hier, - res->conn_res, ca->ca_cdata); + res->conn_res, ca->ca_cdata); /* @invoke cb_extflat_visitresists_t */ } /* diff --git a/extflat/extflat.h b/extflat/extflat.h index 52270cc7..6fd3ac81 100644 --- a/extflat/extflat.h +++ b/extflat/extflat.h @@ -118,8 +118,9 @@ typedef int (*cb_extflat_visitdevs_t)(Dev *dev, HierContext *hc, float scale, Tr extern int EFVisitDevs(const cb_extflat_visitdevs_t devProc, ClientData cdata); extern int efVisitDevs(HierContext *hc, CallArg *ca); extern bool efSymLook(); -extern int efVisitResists(); -extern int EFVisitResists(); +extern int efVisitResists(HierContext *hc, CallArg *ca); +typedef int (*cb_extflat_visitresists_t)(const HierName *hn1, const HierName *hn2, float resistance, ClientData cdata); +extern int EFVisitResists(const cb_extflat_visitresists_t resProc, ClientData cdata); extern int EFVisitNodes(); extern int EFVisitCaps(); extern void EFGetLengthAndWidth();