extflat: integrate cb_extflat_hiervisitresists_t for EFHierVisitResists()

Additionally the HierName's hierName1 and hierName2 arguments have been
made 'const' to help convey the receiver can not modify the referenced
data passed.
This commit is contained in:
Darryl L. Miles 2025-07-20 16:29:20 +01:00
parent 0141a99af5
commit 420a24ef33
3 changed files with 24 additions and 17 deletions

View File

@ -1325,12 +1325,16 @@ spccapHierVisit(
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
/*ARGUSED*/
/* @typedef cb_extflat_hiervisitresists_t (UNUSED) */
int int
spcresistHierVisit( spcresistHierVisit(
HierContext *hc, HierContext *hc,
HierName *hierName1, const HierName *hierName1,
HierName *hierName2, const HierName *hierName2,
float res) float res,
ClientData cdata) // UNUSED
{ {
HashEntry *he; HashEntry *he;
EFNodeName *nn; EFNodeName *nn;
@ -2213,7 +2217,7 @@ esHierVisit(
EFHierVisitDevs(hcf, spcdevHierVisit, PTR2CD(NULL)); EFHierVisitDevs(hcf, spcdevHierVisit, PTR2CD(NULL));
/* Output lumped parasitic resistors */ /* Output lumped parasitic resistors */
EFHierVisitResists(hcf, spcresistHierVisit, (ClientData)NULL); EFHierVisitResists(hcf, spcresistHierVisit, PTR2CD(NULL));
/* Output coupling capacitances */ /* Output coupling capacitances */
EFHierVisitCaps(hcf, spccapHierVisit, (ClientData)NULL); EFHierVisitCaps(hcf, spccapHierVisit, (ClientData)NULL);

View File

@ -559,13 +559,15 @@ efHierVisitSingleResist(hc, name1, name2, res, ca)
* Visit all the resistors in the circuit. * Visit all the resistors in the circuit.
* For each resistor in the circuit, call the user-supplied procedure * For each resistor in the circuit, call the user-supplied procedure
* (*resProc)(), which should be of the following form, where hn1 and * (*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_hiervisitresists_t:
* *
* (*resProc)(hc, hn1, hn2, resistance, cdata) * int (*resProc)(
* HierContext *hc; * HierContext *hc,
* HierName *hn1, *hn2; * const HierName *hierName1,
* int resistance; * const HierName *hierName2,
* ClientData cdata; * float resistance,
* ClientData cdata)
* { * {
* } * }
* *
@ -586,15 +588,15 @@ efHierVisitSingleResist(hc, name1, name2, res, ca)
*/ */
int int
EFHierVisitResists(hc, resProc, cdata) EFHierVisitResists(
HierContext *hc; HierContext *hc,
int (*resProc)(); const cb_extflat_hiervisitresists_t resProc,
ClientData cdata; ClientData cdata)
{ {
CallArg ca; CallArg ca;
int efHierVisitResists(); /* Forward reference */ int efHierVisitResists(); /* Forward reference */
ca.ca_proc = resProc; ca.ca_proc = (int (*)()) resProc;
ca.ca_cdata = cdata; ca.ca_cdata = cdata;
return efHierVisitResists(hc, (ClientData) &ca); return efHierVisitResists(hc, (ClientData) &ca);
} }
@ -630,7 +632,7 @@ efHierVisitResists(hc, ca)
res, ca)) res, ca))
return 1; return 1;
} }
else if (efHierSrArray(hc, res, efHierVisitSingleResist, (ClientData) ca)) else if (efHierSrArray(hc, res, efHierVisitSingleResist, PTR2CD(ca)))
return 1; return 1;
} }
return 0; return 0;

View File

@ -130,7 +130,8 @@ extern int EFVisitSubcircuits();
extern int EFHierVisitSubcircuits(); extern int EFHierVisitSubcircuits();
typedef int (*cb_extflat_hiervisitdevs_t)(HierContext *hc, Dev *dev, float scale, ClientData cdata); typedef int (*cb_extflat_hiervisitdevs_t)(HierContext *hc, Dev *dev, float scale, ClientData cdata);
extern int EFHierVisitDevs(HierContext *hc, const cb_extflat_hiervisitdevs_t devProc, ClientData cdata); extern int EFHierVisitDevs(HierContext *hc, const cb_extflat_hiervisitdevs_t devProc, ClientData cdata);
extern int EFHierVisitResists(); typedef int (*cb_extflat_hiervisitresists_t)(HierContext *hc, const HierName *hierName1, const HierName *hierName2, float resistance, ClientData cdata);
extern int EFHierVisitResists(HierContext *hc, const cb_extflat_hiervisitresists_t resProc, ClientData cdata);
extern int EFHierVisitCaps(); extern int EFHierVisitCaps();
extern int EFHierVisitNodes(); extern int EFHierVisitNodes();